diff --git a/src/backend/distributed/commands/type.c b/src/backend/distributed/commands/type.c index 461fd6d05..74718ea59 100644 --- a/src/backend/distributed/commands/type.c +++ b/src/backend/distributed/commands/type.c @@ -260,22 +260,7 @@ PreprocessCreateEnumStmt(Node *node, const char *queryString, /* enforce fully qualified typeName for correct deparsing and lookup */ QualifyTreeNode(node); - /* reconstruct creation statement in a portable fashion */ - const char *createEnumStmtSql = DeparseCreateEnumStmt(node); - createEnumStmtSql = WrapCreateOrReplace(createEnumStmtSql); - - /* - * when we allow propagation within a transaction block we should make sure to only - * allow this in sequential mode - */ - EnsureSequentialMode(OBJECT_TYPE); - - /* to prevent recursion with mx we disable ddl propagation */ - List *commands = list_make3(DISABLE_DDL_PROPAGATION, - (void *) createEnumStmtSql, - ENABLE_DDL_PROPAGATION); - - return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); + return NIL; } @@ -305,9 +290,24 @@ PostprocessCreateEnumStmt(Node *node, const char *queryString) return NIL; } + /* + * when we allow propagation within a transaction block we should make sure to only + * allow this in sequential mode + */ + EnsureSequentialMode(OBJECT_TYPE); + EnsureDependenciesExistOnAllNodes(&typeAddress); - return NIL; + /* reconstruct creation statement in a portable fashion */ + const char *createEnumStmtSql = DeparseCreateEnumStmt(node); + createEnumStmtSql = WrapCreateOrReplace(createEnumStmtSql); + + /* to prevent recursion with mx we disable ddl propagation */ + List *commands = list_make3(DISABLE_DDL_PROPAGATION, + (void *) createEnumStmtSql, + ENABLE_DDL_PROPAGATION); + + return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); } diff --git a/src/test/regress/expected/distributed_types.out b/src/test/regress/expected/distributed_types.out index 6996a6569..02d419d9b 100644 --- a/src/test/regress/expected/distributed_types.out +++ b/src/test/regress/expected/distributed_types.out @@ -604,11 +604,6 @@ DETAIL: "type temp_type" will be created only locally CREATE TYPE pg_temp.temp_enum AS ENUM ('one', 'two', 'three'); WARNING: "type temp_enum" has dependency on unsupported object "schema pg_temp_xxx" DETAIL: "type temp_enum" will be created only locally -WARNING: cannot PREPARE a transaction that has operated on temporary objects -CONTEXT: while executing command on localhost:xxxxx -WARNING: connection to the remote node localhost:xxxxx failed with the following error: another command is already in progress -ERROR: cannot PREPARE a transaction that has operated on temporary objects -CONTEXT: while executing command on localhost:xxxxx -- clear objects SET client_min_messages TO error; -- suppress cascading objects dropping DROP SCHEMA type_tests CASCADE;