Utility hook does nothing if the extension is not loaded

pull/1201/head v6.1.0-rc2
Brian Cloutier 2017-02-02 17:48:31 +02:00 committed by GitHub
parent a30b9b93a4
commit e6e5f63d9d
1 changed files with 16 additions and 10 deletions

View File

@ -188,6 +188,18 @@ multi_ProcessUtility(Node *parsetree,
return; return;
} }
if (!CitusHasBeenLoaded())
{
/*
* Ensure that utility commands do not behave any differently until CREATE
* EXTENSION is invoked.
*/
standard_ProcessUtility(parsetree, queryString, context,
params, dest, completionTag);
return;
}
/* /*
* TRANSMIT used to be separate command, but to avoid patching the grammar * TRANSMIT used to be separate command, but to avoid patching the grammar
* it's no overlaid onto COPY, but with FORMAT = 'transmit' instead of the * it's no overlaid onto COPY, but with FORMAT = 'transmit' instead of the
@ -301,7 +313,7 @@ multi_ProcessUtility(Node *parsetree,
* AlterTableMoveAllStmt. At the moment we do not support this functionality in * AlterTableMoveAllStmt. At the moment we do not support this functionality in
* the distributed environment. We warn out here. * the distributed environment. We warn out here.
*/ */
if (IsA(parsetree, AlterTableMoveAllStmt) && CitusHasBeenLoaded()) if (IsA(parsetree, AlterTableMoveAllStmt))
{ {
ereport(WARNING, (errmsg("not propagating ALTER TABLE ALL IN TABLESPACE " ereport(WARNING, (errmsg("not propagating ALTER TABLE ALL IN TABLESPACE "
"commands to worker nodes"), "commands to worker nodes"),
@ -339,14 +351,8 @@ multi_ProcessUtility(Node *parsetree,
} }
} }
/* /* inform the user about potential caveats */
* Inform the user about potential caveats. if (IsA(parsetree, CreatedbStmt))
*
* To prevent failures in aborted transactions, CitusHasBeenLoaded() needs
* to be the second condition. See RelationIdGetRelation() which is called
* by CitusHasBeenLoaded().
*/
if (IsA(parsetree, CreatedbStmt) && CitusHasBeenLoaded())
{ {
ereport(NOTICE, (errmsg("Citus partially supports CREATE DATABASE for " ereport(NOTICE, (errmsg("Citus partially supports CREATE DATABASE for "
"distributed databases"), "distributed databases"),
@ -355,7 +361,7 @@ multi_ProcessUtility(Node *parsetree,
errhint("You can manually create a database and its " errhint("You can manually create a database and its "
"extensions on workers."))); "extensions on workers.")));
} }
else if (IsA(parsetree, CreateRoleStmt) && CitusHasBeenLoaded()) else if (IsA(parsetree, CreateRoleStmt))
{ {
ereport(NOTICE, (errmsg("not propagating CREATE ROLE/USER commands to worker" ereport(NOTICE, (errmsg("not propagating CREATE ROLE/USER commands to worker"
" nodes"), " nodes"),