Fixes test errors

pull/7563/head
gurkanindibay 2024-03-30 12:00:55 +03:00
parent 6d964baa0c
commit 0299897395
4 changed files with 27 additions and 37 deletions

View File

@ -697,7 +697,19 @@ PreprocessDropDatabaseStmt(Node *node, const char *queryString,
List * List *
PreprocessAlterDatabaseOwnerStmt(Node *node, const char *queryString, PreprocessAlterDatabaseOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext){ ProcessUtilityContext processUtilityContext){
const DistributeObjectOps *ops = GetDistributeObjectOps(node);
Assert(ops != NULL);
if (ops->featureFlag && *ops->featureFlag == false)
{
/* not propagating when a configured feature flag is turned off by the user */
return NIL;
}
List *addresses = GetObjectAddressListFromParseTree(node, false, false); List *addresses = GetObjectAddressListFromParseTree(node, false, false);
/* the code-path only supports a single object */
Assert(list_length(addresses) == 1);
if (!ShouldPropagateAnyObject(addresses)) if (!ShouldPropagateAnyObject(addresses))
{ {

View File

@ -235,7 +235,7 @@ extern List * PreprocessAlterDatabaseRefreshCollStmt(Node *node, const char *que
ProcessUtilityContext ProcessUtilityContext
processUtilityContext); processUtilityContext);
extern List * PreprocessAlterDatabaseOwnerStmt(Node *node, const char *queryString, extern List * PreprocessAlterDatabaseOwnerStmt(Node *node, const char *queryString,
ProcessUtilityContext processUtilityContext); ProcessUtilityContext processUtilityContext);
extern List * GetDatabaseMetadataSyncCommands(Oid dbOid); extern List * GetDatabaseMetadataSyncCommands(Oid dbOid);

View File

@ -217,56 +217,34 @@ set citus.grep_remote_commands = "%ALTER DATABASE%";
alter database "altered_database!'2" rename to altered_database_renamed; alter database "altered_database!'2" rename to altered_database_renamed;
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" RENAME TO altered_database_renamed', 'postgres') NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" RENAME TO altered_database_renamed', 'postgres')
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database altered_database_renamed rename to "altered_database!'2";
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE altered_database_renamed RENAME TO "altered_database!''2"', 'postgres')
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database "altered_database!'2" with alter database "altered_database!'2" with
ALLOW_CONNECTIONS true ALLOW_CONNECTIONS true
CONNECTION LIMIT 0 CONNECTION LIMIT 0
IS_TEMPLATE false; IS_TEMPLATE false;
NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;', 'postgres') NOTICE: issuing SELECT citus_internal.execute_command_on_remote_nodes_as_user('ALTER DATABASE "altered_database!''2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;', 'postgres')
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
ERROR: database "altered_database!'2" does not exist
\c regression - - :worker_2_port \c regression - - :worker_2_port
set citus.log_remote_commands = true; set citus.log_remote_commands = true;
set citus.grep_remote_commands = "%ALTER DATABASE%";
alter database "altered_database!'2" with alter database "altered_database!'2" with
ALLOW_CONNECTIONS false ALLOW_CONNECTIONS false
CONNECTION LIMIT 1 CONNECTION LIMIT 1
IS_TEMPLATE true; IS_TEMPLATE true;
ERROR: database "altered_database!'2" does not exist NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS false CONNECTION LIMIT 1 IS_TEMPLATE true;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS false CONNECTION LIMIT 1 IS_TEMPLATE true;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database "altered_database!'2" with alter database "altered_database!'2" with
ALLOW_CONNECTIONS true ALLOW_CONNECTIONS true
CONNECTION LIMIT 0 CONNECTION LIMIT 0
IS_TEMPLATE false; IS_TEMPLATE false;
ERROR: database "altered_database!'2" does not exist NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;
alter database altered_database_renamed rename to "altered_database!'2";
NOTICE: issuing BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;SELECT assign_distributed_transaction_id(xx, xx, 'xxxxxxx');
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SELECT citus_internal.acquire_citus_advisory_object_class_lock(26, NULL) NOTICE: issuing ALTER DATABASE "altered_database!'2" WITH ALLOW_CONNECTIONS true CONNECTION LIMIT 0 IS_TEMPLATE false;
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SELECT citus_internal.acquire_citus_advisory_object_class_lock(26, 'altered_database_renamed')
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SET citus.enable_ddl_propagation TO 'off'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing ALTER DATABASE altered_database_renamed RENAME TO "altered_database!'2"
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SET citus.enable_ddl_propagation TO 'on'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing BEGIN TRANSACTION ISOLATION LEVEL READ COMMITTED;SELECT assign_distributed_transaction_id(xx, xx, 'xxxxxxx');
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SET citus.enable_ddl_propagation TO 'off'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing ALTER DATABASE altered_database_renamed RENAME TO "altered_database!'2"
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing SET citus.enable_ddl_propagation TO 'on'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing PREPARE TRANSACTION 'citus_xx_xx_xx_xx'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing PREPARE TRANSACTION 'citus_xx_xx_xx_xx'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing COMMIT PREPARED 'citus_xx_xx_xx_xx'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
NOTICE: issuing COMMIT PREPARED 'citus_xx_xx_xx_xx'
DETAIL: on server postgres@localhost:xxxxx connectionId: xxxxxxx
alter database altered_database_renamed rename to "altered_database!'2";
ERROR: database "altered_database_renamed" does not exist
\c regression \c regression
create role test_owner_non_main_db; create role test_owner_non_main_db;
\c test_alter_db_from_nonmain_db \c test_alter_db_from_nonmain_db

View File

@ -86,6 +86,8 @@ set citus.log_remote_commands = true;
set citus.grep_remote_commands = "%ALTER DATABASE%"; set citus.grep_remote_commands = "%ALTER DATABASE%";
alter database "altered_database!'2" rename to altered_database_renamed; alter database "altered_database!'2" rename to altered_database_renamed;
alter database altered_database_renamed rename to "altered_database!'2";
alter database "altered_database!'2" with alter database "altered_database!'2" with
ALLOW_CONNECTIONS true ALLOW_CONNECTIONS true
@ -94,6 +96,7 @@ alter database "altered_database!'2" with
\c regression - - :worker_2_port \c regression - - :worker_2_port
set citus.log_remote_commands = true; set citus.log_remote_commands = true;
set citus.grep_remote_commands = "%ALTER DATABASE%";
alter database "altered_database!'2" with alter database "altered_database!'2" with
ALLOW_CONNECTIONS false ALLOW_CONNECTIONS false
@ -104,9 +107,6 @@ alter database "altered_database!'2" with
CONNECTION LIMIT 0 CONNECTION LIMIT 0
IS_TEMPLATE false; IS_TEMPLATE false;
alter database altered_database_renamed rename to "altered_database!'2";
alter database altered_database_renamed rename to "altered_database!'2";