mirror of https://github.com/citusdata/citus.git
Address PostgreSQL 10's planned stmt changes
PostgreSQL appears to now stash the PlannedStmt somewhere within ProcessUtility itself (per Marco), which results in a use-after-free bug if we keep our old behavior of overriding the PlannedStmt's utility statement with a copy with baked-in schema names. The quickest fix is to just avoid this behavior altogether for PostgreSQL 10. Because this area of code needs some attention anyhow (i.e. we're not always doing the right things wrt schema name lookups for our utility statements), Marco suggested this fix until we get to a more comprehensive correction covering other utility commands.pull/1439/head
parent
87d1928f0c
commit
38f25020e3
|
@ -326,10 +326,18 @@ multi_ProcessUtility10(PlannedStmt *pstmt,
|
||||||
{
|
{
|
||||||
if (IsA(parsetree, IndexStmt))
|
if (IsA(parsetree, IndexStmt))
|
||||||
{
|
{
|
||||||
/* copy parse tree since we might scribble on it to fix the schema name */
|
/*
|
||||||
parsetree = copyObject(parsetree);
|
* copy parse tree since we might scribble on it to fix the schema name
|
||||||
|
* FIXME: PostgreSQL 10 changes caching behavior and breaks this approach,
|
||||||
|
* so for that version we do assign back the modified tree.
|
||||||
|
*/
|
||||||
|
Node *parsetreeCopy = copyObject(parsetree);
|
||||||
|
|
||||||
ddlJobs = PlanIndexStmt((IndexStmt *) parsetree, queryString);
|
ddlJobs = PlanIndexStmt((IndexStmt *) parsetreeCopy, queryString);
|
||||||
|
|
||||||
|
#if (PG_VERSION_NUM < 100000)
|
||||||
|
parsetree = parsetreeCopy;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsA(parsetree, DropStmt))
|
if (IsA(parsetree, DropStmt))
|
||||||
|
|
Loading…
Reference in New Issue