diff --git a/src/backend/distributed/commands/grant.c b/src/backend/distributed/commands/grant.c index 182c7152d..7bcfacb70 100644 --- a/src/backend/distributed/commands/grant.c +++ b/src/backend/distributed/commands/grant.c @@ -13,14 +13,21 @@ #include "catalog/namespace.h" #include "distributed/commands.h" #include "distributed/metadata_cache.h" +#include "distributed/master_protocol.h" /* placeholder for PreprocessGrantStmt */ List * PreprocessGrantStmt(Node *node, const char *queryString) { + GrantStmt *grantStmt = castNode(GrantStmt, node); bool showPropagationWarning = false; + /* don't emit warnings in worker nodes */ + if (!IsCoordinator()) + { + return NIL; + } if (grantStmt->targtype == ACL_TARGET_ALL_IN_SCHEMA) { diff --git a/src/test/regress/expected/multi_router_planner.out b/src/test/regress/expected/multi_router_planner.out index a4db688af..b91174cd9 100644 --- a/src/test/regress/expected/multi_router_planner.out +++ b/src/test/regress/expected/multi_router_planner.out @@ -2408,6 +2408,7 @@ CREATE USER router_user; NOTICE: not propagating CREATE ROLE/USER commands to worker nodes HINT: Connect to worker nodes directly to manually create all necessary users and roles. GRANT INSERT ON ALL TABLES IN SCHEMA public TO router_user; +WARNING: not propagating GRANT command to worker nodes \c - router_user - :master_port -- first test that it is marked invalid inside a transaction block -- we will fail to connect to worker 2, since the user does not exist diff --git a/src/test/regress/expected/multi_schema_support.out b/src/test/regress/expected/multi_schema_support.out index dae406c50..2fce3bc4d 100644 --- a/src/test/regress/expected/multi_schema_support.out +++ b/src/test/regress/expected/multi_schema_support.out @@ -1240,6 +1240,9 @@ PL/pgSQL function run_command_on_coordinator_and_workers(text) line 3 at EXECUTE (1 row) SELECT run_command_on_coordinator_and_workers('GRANT ALL ON DATABASE postgres to "test-user"'); +WARNING: not propagating GRANT command to worker nodes +CONTEXT: SQL statement "GRANT ALL ON DATABASE postgres to "test-user"" +PL/pgSQL function run_command_on_coordinator_and_workers(text) line 3 at EXECUTE run_command_on_coordinator_and_workers --------------------------------------------------------------------- diff --git a/src/test/regress/expected/multi_transactional_drop_shards.out b/src/test/regress/expected/multi_transactional_drop_shards.out index 867e434c0..51bd724b0 100644 --- a/src/test/regress/expected/multi_transactional_drop_shards.out +++ b/src/test/regress/expected/multi_transactional_drop_shards.out @@ -689,6 +689,7 @@ CREATE USER try_drop_table WITH LOGIN; NOTICE: not propagating CREATE ROLE/USER commands to worker nodes HINT: Connect to worker nodes directly to manually create all necessary users and roles. GRANT ALL ON SCHEMA public TO try_drop_table; +WARNING: not propagating GRANT command to worker nodes SELECT run_command_on_workers('CREATE USER try_drop_table WITH LOGIN'); run_command_on_workers ---------------------------------------------------------------------