Backport get_all_actual_clauses

This is the sole PostgreSQL 10 change that "breaks" Citus; we use this
function and no alternative is available. Fortunately, it's small
enough to copy-paste.
pull/1439/head
Jason Petersen 2017-04-19 23:29:13 -06:00
parent 59a4fb596c
commit 6c48c93b6a
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
1 changed files with 34 additions and 0 deletions

View File

@ -134,6 +134,9 @@ static DeferredErrorMessage * InsertPartitionColumnMatchesSelect(Query *query,
Oid *
selectPartitionColumnTableId);
static DeferredErrorMessage * ErrorIfQueryHasModifyingCTE(Query *queryTree);
#if (PG_VERSION_NUM >= 100000)
static List * get_all_actual_clauses(List *restrictinfo_list);
#endif
/*
@ -3026,3 +3029,34 @@ ErrorIfQueryHasModifyingCTE(Query *queryTree)
/* everything OK */
return NULL;
}
#if (PG_VERSION_NUM >= 100000)
/*
* get_all_actual_clauses
*
* Returns a list containing the bare clauses from 'restrictinfo_list'.
*
* This loses the distinction between regular and pseudoconstant clauses,
* so be careful what you use it for.
*/
static List *
get_all_actual_clauses(List *restrictinfo_list)
{
List *result = NIL;
ListCell *l;
foreach(l, restrictinfo_list)
{
RestrictInfo *rinfo = (RestrictInfo *) lfirst(l);
Assert(IsA(rinfo, RestrictInfo));
result = lappend(result, rinfo->clause);
}
return result;
}
#endif