mirror of https://github.com/citusdata/citus.git
Fix crash in Range Table identity check.
The range table entry array created by the Postgres planner for each SELECT in a query may have NULL entries as of PG18. Add a NULL check to skip over these when looking for matches in rte identities.pull/7723/head
parent
80945212ae
commit
81776fe190
|
|
@ -2431,7 +2431,7 @@ FilterJoinRestrictionContext(JoinRestrictionContext *joinRestrictionContext, Rel
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RangeTableArrayContainsAnyRTEIdentities returns true if any of the range table entries
|
* RangeTableArrayContainsAnyRTEIdentities returns true if any of the range table entries
|
||||||
* int rangeTableEntries array is an range table relation specified in queryRteIdentities.
|
* in rangeTableEntries array is a range table relation specified in queryRteIdentities.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
RangeTableArrayContainsAnyRTEIdentities(RangeTblEntry **rangeTableEntries, int
|
RangeTableArrayContainsAnyRTEIdentities(RangeTblEntry **rangeTableEntries, int
|
||||||
|
|
@ -2444,6 +2444,18 @@ RangeTableArrayContainsAnyRTEIdentities(RangeTblEntry **rangeTableEntries, int
|
||||||
List *rangeTableRelationList = NULL;
|
List *rangeTableRelationList = NULL;
|
||||||
ListCell *rteRelationCell = NULL;
|
ListCell *rteRelationCell = NULL;
|
||||||
|
|
||||||
|
#if PG_VERSION_NUM >= PG_VERSION_18
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In PG18+, planner array simple_rte_array may contain NULL entries
|
||||||
|
* for "dead relations". See PG commits 5f6f951 and e9a20e4 for details.
|
||||||
|
*/
|
||||||
|
if (rangeTableEntry == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get list of all RTE_RELATIONs in the given range table entry
|
* Get list of all RTE_RELATIONs in the given range table entry
|
||||||
* (i.e.,rangeTableEntry could be a subquery where we're interested
|
* (i.e.,rangeTableEntry could be a subquery where we're interested
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue