From e6e5f63d9dc3da3b1cb59f8cfb76e6ffc8dbd54e Mon Sep 17 00:00:00 2001 From: Brian Cloutier Date: Thu, 2 Feb 2017 17:48:31 +0200 Subject: [PATCH] Utility hook does nothing if the extension is not loaded --- .../distributed/executor/multi_utility.c | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/backend/distributed/executor/multi_utility.c b/src/backend/distributed/executor/multi_utility.c index 528d10f28..9f85cf366 100644 --- a/src/backend/distributed/executor/multi_utility.c +++ b/src/backend/distributed/executor/multi_utility.c @@ -188,6 +188,18 @@ multi_ProcessUtility(Node *parsetree, 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 * 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 * 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 " "commands to worker nodes"), @@ -339,14 +351,8 @@ multi_ProcessUtility(Node *parsetree, } } - /* - * Inform the user about potential caveats. - * - * 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()) + /* inform the user about potential caveats */ + if (IsA(parsetree, CreatedbStmt)) { ereport(NOTICE, (errmsg("Citus partially supports CREATE DATABASE for " "distributed databases"), @@ -355,7 +361,7 @@ multi_ProcessUtility(Node *parsetree, errhint("You can manually create a database and its " "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" " nodes"),