Skip to content

Commit

Permalink
fix 7091 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Морозов Константин authored and Морозов Константин committed Jul 2, 2024
1 parent 58fef24 commit 655df3d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/backend/distributed/commands/utility_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,14 @@ citus_ProcessUtilityInternal(PlannedStmt *pstmt,
if (ops && ops->markDistributed)
{
List *addresses = GetObjectAddressListFromParseTree(parsetree, false, true);
ObjectAddress *address = NULL;
foreach_ptr(address, addresses)
if (!IsAnyObjectDistributed(addresses))
{
MarkObjectDistributed(address);
TrackPropagatedObject(address);
ObjectAddress *address = NULL;
foreach_ptr(address, addresses)
{
MarkObjectDistributed(address);
TrackPropagatedObject(address);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
CREATE SCHEMA non_super_user_create_existing_extension;
SET search_path TO non_super_user_create_existing_extension;
SELECT CURRENT_USER;
current_user
---------------------------------------------------------------------
postgres
(1 row)

CREATE EXTENSION if not exists "uuid-ossp" SCHEMA public;
CREATE EXTENSION if not exists "uuid-ossp" SCHEMA public;
NOTICE: extension "uuid-ossp" already exists, skipping
CREATE USER non_super_user_ext;
SET ROLE non_super_user_ext;
SELECT CURRENT_USER;
current_user
---------------------------------------------------------------------
non_super_user_ext
(1 row)

CREATE EXTENSION if not exists "uuid-ossp" SCHEMA public;
NOTICE: extension "uuid-ossp" already exists, skipping
RESET ROLE;
SELECT CURRENT_USER;
current_user
---------------------------------------------------------------------
postgres
(1 row)

DROP USER non_super_user_ext;
DROP SCHEMA non_super_user_create_existing_extension CASCADE;
1 change: 1 addition & 0 deletions src/test/regress/multi_schedule
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ test: background_task_queue_monitor
test: other_databases grant_role_from_non_maindb role_operations_from_non_maindb seclabel_non_maindb
test: citus_internal_access
test: function_with_case_when
test: non_super_user_create_existing_extension

# Causal clock test
test: clock
Expand Down
14 changes: 14 additions & 0 deletions src/test/regress/sql/non_super_user_create_existing_extension.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE SCHEMA non_super_user_create_existing_extension;
SET search_path TO non_super_user_create_existing_extension;

SELECT CURRENT_USER;
CREATE EXTENSION if not exists "uuid-ossp" SCHEMA public;
CREATE EXTENSION if not exists "uuid-ossp" SCHEMA public;
CREATE USER non_super_user_ext;
SET ROLE non_super_user_ext;
SELECT CURRENT_USER;
CREATE EXTENSION if not exists "uuid-ossp" SCHEMA public;
RESET ROLE;
SELECT CURRENT_USER;
DROP USER non_super_user_ext;
DROP SCHEMA non_super_user_create_existing_extension CASCADE;

0 comments on commit 655df3d

Please sign in to comment.