diff --git a/src/backend/distributed/commands/database.c b/src/backend/distributed/commands/database.c index aab3b44f6..175858464 100644 --- a/src/backend/distributed/commands/database.c +++ b/src/backend/distributed/commands/database.c @@ -214,20 +214,20 @@ PreprocessAlterDatabaseStmt(Node *node, const char *queryString, /*Set tablespace does not work inside a transaction.Therefore, we close the transaction before set tablespace * and open it again after set tablespace. */ - commands = list_make5(DISABLE_DDL_PROPAGATION, - COMMIT_TRANSACTION, + commands = list_make3(DISABLE_DDL_PROPAGATION, sql, - BEGIN_TRANSACTION, ENABLE_DDL_PROPAGATION); + return NontransactionalNodeDDLTask(NON_COORDINATOR_NODES, commands); } else { commands = list_make3(DISABLE_DDL_PROPAGATION, (void *) sql, ENABLE_DDL_PROPAGATION); + return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); } - return NodeDDLTaskList(NON_COORDINATOR_NODES, commands); + return NIL; } diff --git a/src/backend/distributed/deparser/deparse_database_stmts.c b/src/backend/distributed/deparser/deparse_database_stmts.c index b3f12b03a..986c1bb86 100644 --- a/src/backend/distributed/deparser/deparse_database_stmts.c +++ b/src/backend/distributed/deparser/deparse_database_stmts.c @@ -52,7 +52,7 @@ const struct option_format create_database_option_formats[] = { const struct option_format alter_database_option_formats[] = { { "is_template", " IS_TEMPLATE %s", OPTION_FORMAT_BOOLEAN }, { "allow_connections", " ALLOW_CONNECTIONS %s", OPTION_FORMAT_BOOLEAN }, - { "connection_limit", " CONNECTION_LIMIT %d", OPTION_FORMAT_INTEGER }, + { "connection_limit", " CONNECTION LIMIT %d", OPTION_FORMAT_INTEGER }, }; char * @@ -119,7 +119,7 @@ AppendBasicAlterDatabaseOptions(StringInfo buf, DefElem *def, bool { if (!prefix_appended_for_basic_options) { - appendStringInfo(buf, "ALTER DATABASE %s WITH ", quote_identifier(dbname)); + appendStringInfo(buf, "ALTER DATABASE %s WITH", quote_identifier(dbname)); prefix_appended_for_basic_options = true; } optionToStatement(buf, def, alter_database_option_formats, lengthof( diff --git a/src/test/regress/expected/alter_database_propagation.out b/src/test/regress/expected/alter_database_propagation.out index 94eca2190..722c8973f 100644 --- a/src/test/regress/expected/alter_database_propagation.out +++ b/src/test/regress/expected/alter_database_propagation.out @@ -1,29 +1,29 @@ set citus.log_remote_commands = true; set citus.grep_remote_commands = '%ALTER DATABASE%'; alter database regression with CONNECTION LIMIT 100; -NOTICE: issuing ALTER DATABASE regression WITH CONNECTION_LIMIT 100; +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression WITH CONNECTION_LIMIT 100; +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT 100; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression with IS_TEMPLATE true CONNECTION LIMIT 50; -NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true CONNECTION_LIMIT 50; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true CONNECTION LIMIT 50; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true CONNECTION_LIMIT 50; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true CONNECTION LIMIT 50; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression with CONNECTION LIMIT -1; -NOTICE: issuing ALTER DATABASE regression WITH CONNECTION_LIMIT -1; +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression WITH CONNECTION_LIMIT -1; +NOTICE: issuing ALTER DATABASE regression WITH CONNECTION LIMIT -1; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression with IS_TEMPLATE true; -NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE true; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression with IS_TEMPLATE false; -NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE false; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE false; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE false; +NOTICE: issuing ALTER DATABASE regression WITH IS_TEMPLATE false; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression set default_transaction_read_only = true; NOTICE: issuing ALTER DATABASE regression SET default_transaction_read_only = 'true' @@ -142,19 +142,19 @@ DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx set citus.enable_create_database_propagation=on; create database regression2; alter database regression2 with CONNECTION LIMIT 100; -NOTICE: issuing ALTER DATABASE regression2 WITH CONNECTION_LIMIT 100; +NOTICE: issuing ALTER DATABASE regression2 WITH CONNECTION LIMIT 100; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression2 WITH CONNECTION_LIMIT 100; +NOTICE: issuing ALTER DATABASE regression2 WITH CONNECTION LIMIT 100; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression2 with IS_TEMPLATE true CONNECTION LIMIT 50; -NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE true CONNECTION_LIMIT 50; +NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE true CONNECTION LIMIT 50; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE true CONNECTION_LIMIT 50; +NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE true CONNECTION LIMIT 50; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx alter database regression2 with IS_TEMPLATE false; -NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE false; +NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE false; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx -NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE false; +NOTICE: issuing ALTER DATABASE regression2 WITH IS_TEMPLATE false; DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx \set alter_db_tablespace :abs_srcdir '/tmp_check/ts3' CREATE TABLESPACE alter_db_tablespace LOCATION :'alter_db_tablespace'; diff --git a/src/test/regress/multi_1_schedule b/src/test/regress/multi_1_schedule index f53cb3a34..3ad0eabfc 100644 --- a/src/test/regress/multi_1_schedule +++ b/src/test/regress/multi_1_schedule @@ -58,7 +58,6 @@ test: alter_database_propagation test: citus_shards - # ---------- # multi_citus_tools tests utility functions written for citus tools # ----------