|
| 1 | +/* ------------------------------------------------------------------------ |
| 2 | + * |
| 3 | + * pg_compat.h |
| 4 | + *Compatibility tools |
| 5 | + * |
| 6 | + * Copyright (c) 2016, Postgres Professional |
| 7 | + * |
| 8 | + * ------------------------------------------------------------------------ |
| 9 | + */ |
| 10 | + |
| 11 | +#ifndefPG_COMPAT_H |
| 12 | +#definePG_COMPAT_H |
| 13 | + |
| 14 | +#include"postgres.h" |
| 15 | + |
| 16 | +#include"nodes/relation.h" |
| 17 | +#include"nodes/pg_list.h" |
| 18 | +#include"optimizer/cost.h" |
| 19 | +#include"optimizer/paths.h" |
| 20 | + |
| 21 | + |
| 22 | +externvoidset_append_rel_size_compat(PlannerInfo*root,RelOptInfo*rel, |
| 23 | +Indexrti,RangeTblEntry*rte); |
| 24 | +externvoidcopy_targetlist_compat(RelOptInfo*dest,RelOptInfo*rel); |
| 25 | + |
| 26 | +#ifPG_VERSION_NUM >=90600 |
| 27 | + |
| 28 | +#defineget_parameterized_joinrel_size_compat(root,rel,outer_path, \ |
| 29 | +inner_path,sjinfo, \ |
| 30 | +restrict_clauses) \ |
| 31 | +get_parameterized_joinrel_size(root, rel, outer_path, \ |
| 32 | + inner_path, sjinfo, \ |
| 33 | + restrict_clauses) |
| 34 | + |
| 35 | +#definecheck_index_predicates_compat(rool,rel) \ |
| 36 | +check_index_predicates(root, rel) |
| 37 | + |
| 38 | +#definecreate_append_path_compat(rel,subpaths,required_outer,parallel_workers) \ |
| 39 | +create_append_path(rel, subpaths, required_outer, parallel_workers) |
| 40 | + |
| 41 | +#definepull_var_clause_compat(node,aggbehavior,phbehavior) \ |
| 42 | +pull_var_clause(node, aggbehavior | phbehavior) |
| 43 | + |
| 44 | +externResult*make_result(List*tlist,Node*resconstantqual,Plan*subplan); |
| 45 | +#definemake_result_compat(root,tlist,resconstantqual,subplan) \ |
| 46 | +make_result(tlist, resconstantqual, subplan) |
| 47 | + |
| 48 | +#else/* PG_VERSION_NUM >= 90500 */ |
| 49 | + |
| 50 | +#defineget_parameterized_joinrel_size_compat(root,rel, \ |
| 51 | +outer_path, \ |
| 52 | +inner_path, \ |
| 53 | +sjinfo,restrict_clauses) \ |
| 54 | +get_parameterized_joinrel_size(root, rel, \ |
| 55 | + (outer_path)->rows, \ |
| 56 | + (inner_path)->rows, \ |
| 57 | + sjinfo, restrict_clauses) |
| 58 | + |
| 59 | +#definecheck_index_predicates_compat(rool,rel) \ |
| 60 | +check_partial_indexes(root, rel) |
| 61 | + |
| 62 | +#definecreate_append_path_compat(rel,subpaths,required_outer,parallel_workers) \ |
| 63 | +create_append_path(rel, subpaths, required_outer) |
| 64 | + |
| 65 | +#definepull_var_clause_compat(node,aggbehavior,phbehavior) \ |
| 66 | +pull_var_clause(node, aggbehavior, phbehavior) |
| 67 | + |
| 68 | +#definemake_result_compat(root,tlist,resconstantqual,subplan) \ |
| 69 | +make_result(root, tlist, resconstantqual, subplan) |
| 70 | + |
| 71 | +#endif |
| 72 | + |
| 73 | + |
| 74 | +#endif/* PG_COMPAT_H */ |