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

View File

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

View File

@ -2054,7 +2054,7 @@ GetRestrictInfoListForRelation(RangeTblEntry *rangeTblEntry,
* If the restriction involves multiple tables, we cannot add it to
* 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)
{
continue;

View File

@ -60,6 +60,8 @@
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
#define get_partition_parent_compat(a, b) get_partition_parent(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
#define AlterTableStmtObjType(a) ((a)->relkind)
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
@ -94,6 +96,8 @@
#define get_partition_parent_compat(a, b) get_partition_parent(a)
#define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a)
#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
#if PG_VERSION_NUM >= PG_VERSION_13