mirror of https://github.com/citusdata/citus.git
Fix crash on create statistics when it's not created on relation
This crash has been there for a while, but wasn't tested before pg18. PG18 added this test: CREATE STATISTICS tst ON a FROM (VALUES (x)) AS foo; which tries to create statistics on a derived-on-the-fly table (which is not allowed) However Citus assumes we always have a valid table when intercepting CREATE STATISTICS command to check for Citus tables Added a check to return early if needednaisila/pg18_testing
parent
d9f872058f
commit
9cb35fc7b8
|
|
@ -70,6 +70,12 @@ PreprocessCreateStatisticsStmt(Node *node, const char *queryString,
|
|||
CreateStatsStmt *stmt = castNode(CreateStatsStmt, node);
|
||||
|
||||
RangeVar *relation = (RangeVar *) linitial(stmt->relations);
|
||||
|
||||
if (!IsA(relation, RangeVar))
|
||||
{
|
||||
return NIL;
|
||||
}
|
||||
|
||||
Oid relationId = RangeVarGetRelid(relation, ShareUpdateExclusiveLock, false);
|
||||
|
||||
if (!IsCitusTable(relationId) || !ShouldPropagate())
|
||||
|
|
|
|||
Loading…
Reference in New Issue