Introduces make_simple_restrictinfo_compat and pull_varnos_compat macros

make_simple_restrictinfo and pull_varnos functions now have a new parameter
These new macros give us the ability to use this new parameter for PG14 and they don't give the parameter for previous versions

Relevant PG commit:
55dc86eca70b1dc18a79c141b3567efed910329d
talha_pg14_support
Halil Ozan Akgul 2021-08-19 19:01:26 +03:00 committed by Sait Talha Nisanci
parent 0274219215
commit eff273c0a3
4 changed files with 11 additions and 5 deletions

View File

@ -672,8 +672,9 @@ ShardsMatchingDeleteCriteria(Oid relationId, List *shardIntervalList,
Expr *lessThanExpr = (Expr *) linitial(andExpr->args); Expr *lessThanExpr = (Expr *) linitial(andExpr->args);
Expr *greaterThanExpr = (Expr *) lsecond(andExpr->args); Expr *greaterThanExpr = (Expr *) lsecond(andExpr->args);
RestrictInfo *lessThanRestrictInfo = make_simple_restrictinfo(NULL, lessThanExpr); RestrictInfo *lessThanRestrictInfo = make_simple_restrictinfo_compat(NULL,
RestrictInfo *greaterThanRestrictInfo = make_simple_restrictinfo(NULL, lessThanExpr);
RestrictInfo *greaterThanRestrictInfo = make_simple_restrictinfo_compat(NULL,
greaterThanExpr); greaterThanExpr);
restrictInfoList = lappend(restrictInfoList, lessThanRestrictInfo); restrictInfoList = lappend(restrictInfoList, lessThanRestrictInfo);

View File

@ -747,7 +747,8 @@ RouterModifyTaskForShardInterval(Query *originalQuery,
continue; continue;
} }
shardRestrictionList = make_simple_restrictinfo(NULL, (Expr *) shardOpExpressions); shardRestrictionList = make_simple_restrictinfo_compat(NULL,
(Expr *) shardOpExpressions);
extendedBaseRestrictInfo = lappend(extendedBaseRestrictInfo, extendedBaseRestrictInfo = lappend(extendedBaseRestrictInfo,
shardRestrictionList); shardRestrictionList);

View File

@ -2054,7 +2054,7 @@ GetRestrictInfoListForRelation(RangeTblEntry *rangeTblEntry,
* If the restriction involves multiple tables, we cannot add it to * If the restriction involves multiple tables, we cannot add it to
* input relation's expression list. * input relation's expression list.
*/ */
Relids varnos = pull_varnos(NULL, (Node *) restrictionClause); Relids varnos = pull_varnos_compat(NULL, (Node *) restrictionClause);
if (bms_num_members(varnos) != 1) if (bms_num_members(varnos) != 1)
{ {
continue; continue;

View File

@ -60,6 +60,8 @@
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags) #define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
#define get_partition_parent_compat(a, b) get_partition_parent(a, b) #define get_partition_parent_compat(a, b) get_partition_parent(a, b)
#define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a, b) #define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a, b)
#define make_simple_restrictinfo_compat(a, b) make_simple_restrictinfo(a, b)
#define pull_varnos_compat(a, b) pull_varnos(a, b)
#else #else
#define AlterTableStmtObjType(a) ((a)->relkind) #define AlterTableStmtObjType(a) ((a)->relkind)
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID #define F_NEXTVAL_COMPAT F_NEXTVAL_OID
@ -94,6 +96,8 @@
#define get_partition_parent_compat(a, b) get_partition_parent(a) #define get_partition_parent_compat(a, b) get_partition_parent(a)
#define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a) #define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a)
#define PQ_LARGE_MESSAGE_LIMIT 0 #define PQ_LARGE_MESSAGE_LIMIT 0
#define make_simple_restrictinfo_compat(a, b) make_simple_restrictinfo(b)
#define pull_varnos_compat(a, b) pull_varnos(b)
#endif #endif
#if PG_VERSION_NUM >= PG_VERSION_13 #if PG_VERSION_NUM >= PG_VERSION_13