diff --git a/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py b/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py index 52924aa11af..110ceed0950 100755 --- a/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py +++ b/src/test/regress/citus_tests/arbitrary_configs/citus_arbitrary_configs.py @@ -34,7 +34,7 @@ parallel_thread_amount = 1 -def _run_pg_regress_on_port(config, port, schedule_name, extra_tests=""): +def _run_pg_regress_on_port(config, port, schedule_name, user, extra_tests=""): return common.run_pg_regress_without_exit( config.bindir, config.pg_srcdir, @@ -42,7 +42,7 @@ def _run_pg_regress_on_port(config, port, schedule_name, extra_tests=""): schedule_name, config.output_dir, config.input_dir, - config.user, + user, extra_tests, ) @@ -54,12 +54,11 @@ def run_for_config(config, lock, sql_schedule_name): common.initialize_citus_cluster( config.bindir, config.datadir, config.settings, config ) - if config.user == cfg.REGULAR_USER_NAME: - common.create_role( - config.bindir, - config.node_name_to_ports.values(), - config.user, - ) + common.create_role( + config.bindir, + config.node_name_to_ports.values(), + cfg.REGULAR_USER_NAME, + ) copy_copy_modified_binary(config.datadir) copy_test_files(config) @@ -91,20 +90,25 @@ def run_for_config(config, lock, sql_schedule_name): ) exitCode |= _run_pg_regress_on_port( - config, config.coordinator_port(), cfg.CREATE_SCHEDULE + config, config.coordinator_port(), cfg.CREATE_SCHEDULE, config.owner_role ) common.save_regression_diff("create", config.output_dir) extra_tests = os.getenv("EXTRA_TESTS", "") if config.is_mx and config.worker_amount > 0: exitCode |= _run_pg_regress_on_port( - config, config.random_port(), sql_schedule_name, extra_tests=extra_tests + config, + config.random_port(), + sql_schedule_name, + config.user, + extra_tests=extra_tests, ) else: exitCode |= _run_pg_regress_on_port( config, config.coordinator_port(), sql_schedule_name, + config.user, extra_tests=extra_tests, ) diff --git a/src/test/regress/citus_tests/config.py b/src/test/regress/citus_tests/config.py index 9b81863e263..dd0b9f245c6 100644 --- a/src/test/regress/citus_tests/config.py +++ b/src/test/regress/citus_tests/config.py @@ -99,7 +99,12 @@ def __init__(self, arguments): self.pg_srcdir = arguments["--pgxsdir"] self.temp_dir = CITUS_ARBITRARY_TEST_DIR self.worker_amount = 2 + # User is that will execute the sql scripts self.user = REGULAR_USER_NAME + # If owner_role is set to something else than None, that role will be + # used to execute all the xyz_create.sql scripts, so that the tables + # are owned by that role. + self.owner_role = None self.dbname = DATABASE_NAME self.is_mx = True self.is_citus = True @@ -129,6 +134,8 @@ def post_init(self): self.output_file = os.path.join(self.datadir, "run.out") if self.worker_amount > 0: self.chosen_random_worker_port = self.random_worker_port() + if self.owner_role is None: + self.owner_role = self.user self.settings.update(self.new_settings) def coordinator_port(self): @@ -177,6 +184,11 @@ def __init__(self, arguments): "arbitrary_configs_alter_table_add_constraint_without_name", ] +class CitusGrantedPermissionsClusterConfig(CitusDefaultClusterConfig): + def __init__(self, arguments): + super().__init__(arguments) + self.owner_role = SUPER_USER_NAME + class CitusUpgradeConfig(CitusBaseClusterConfig): def __init__(self, arguments, pre_tar, post_tar): diff --git a/src/test/regress/create_schedule b/src/test/regress/create_schedule index e301678b9de..efedf390b06 100644 --- a/src/test/regress/create_schedule +++ b/src/test/regress/create_schedule @@ -1,3 +1,4 @@ +test: auto_grant_all_to_regularuser test: intermediate_result_pruning_create test: prepared_statements_create_load ch_benchmarks_create_load test: dropped_columns_create_load distributed_planning_create_load diff --git a/src/test/regress/expected/arbitrary_configs_truncate_cascade_create.out b/src/test/regress/expected/arbitrary_configs_truncate_cascade_create.out index 00caa435ed9..205e345f12f 100644 --- a/src/test/regress/expected/arbitrary_configs_truncate_cascade_create.out +++ b/src/test/regress/expected/arbitrary_configs_truncate_cascade_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA truncate_cascade_tests_schema; SET search_path TO truncate_cascade_tests_schema; +GRANT ALL ON SCHEMA truncate_cascade_tests_schema TO regularuser; -- tables connected with foreign keys CREATE TABLE table_with_pk(a bigint PRIMARY KEY); CREATE TABLE table_with_fk_1(a bigint, b bigint, FOREIGN KEY (b) REFERENCES table_with_pk(a)); diff --git a/src/test/regress/expected/arbitrary_configs_truncate_create.out b/src/test/regress/expected/arbitrary_configs_truncate_create.out index ba19ab64f2d..c02854e2af7 100644 --- a/src/test/regress/expected/arbitrary_configs_truncate_create.out +++ b/src/test/regress/expected/arbitrary_configs_truncate_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA truncate_tests_schema; SET search_path TO truncate_tests_schema; +GRANT ALL ON SCHEMA truncate_tests_schema TO regularuser; -- simple table CREATE TABLE basic_table(a int); -- partioned table diff --git a/src/test/regress/expected/arbitrary_configs_truncate_partition_create.out b/src/test/regress/expected/arbitrary_configs_truncate_partition_create.out index 3ffbb036a80..a2fc50ff3a5 100644 --- a/src/test/regress/expected/arbitrary_configs_truncate_partition_create.out +++ b/src/test/regress/expected/arbitrary_configs_truncate_partition_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA truncate_partition_tests_schema; SET search_path TO truncate_partition_tests_schema; +GRANT ALL ON SCHEMA truncate_partition_tests_schema TO regularuser; -- partioned table CREATE TABLE partitioned_table(a int) PARTITION BY RANGE(a); CREATE TABLE partitioned_table_0 PARTITION OF partitioned_table diff --git a/src/test/regress/expected/auto_grant_all_to_regularuser.out b/src/test/regress/expected/auto_grant_all_to_regularuser.out new file mode 100644 index 00000000000..959d8a9faec --- /dev/null +++ b/src/test/regress/expected/auto_grant_all_to_regularuser.out @@ -0,0 +1,5 @@ +ALTER DEFAULT PRIVILEGES GRANT ALL ON SCHEMAS TO regularuser; -- does not work with citus +ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO regularuser; -- does not work for views with citus +ALTER DEFAULT PRIVILEGES GRANT ALL ON TYPES TO regularuser; +ALTER DEFAULT PRIVILEGES GRANT ALL ON SEQUENCES TO regularuser; +ALTER DEFAULT PRIVILEGES GRANT ALL ON FUNCTIONS TO regularuser; diff --git a/src/test/regress/expected/ch_benchmarks_create_load.out b/src/test/regress/expected/ch_benchmarks_create_load.out index 217b53b7b99..8c246509a21 100644 --- a/src/test/regress/expected/ch_benchmarks_create_load.out +++ b/src/test/regress/expected/ch_benchmarks_create_load.out @@ -1,5 +1,6 @@ CREATE SCHEMA "ch benchmarks"; SET search_path to "ch benchmarks"; +GRANT ALL ON SCHEMA "ch benchmarks" TO regularuser; CREATE TABLE order_line ( ol_w_id int NOT NULL, ol_d_id int NOT NULL, diff --git a/src/test/regress/expected/distributed_planning_create_load.out b/src/test/regress/expected/distributed_planning_create_load.out index adfed245e96..1440898da9b 100644 --- a/src/test/regress/expected/distributed_planning_create_load.out +++ b/src/test/regress/expected/distributed_planning_create_load.out @@ -1,5 +1,6 @@ CREATE SCHEMA "distributed planning"; SET search_path TO "distributed planning"; +GRANT ALL ON SCHEMA "distributed planning" TO regularuser; CREATE TABLE date_part_table (event_time timestamp, event int, user_id int) partition by range (event_time); diff --git a/src/test/regress/expected/dropped_columns_create_load.out b/src/test/regress/expected/dropped_columns_create_load.out index 1d5bbf4dab8..396b9774a30 100644 --- a/src/test/regress/expected/dropped_columns_create_load.out +++ b/src/test/regress/expected/dropped_columns_create_load.out @@ -1,5 +1,6 @@ CREATE SCHEMA local_shard_execution_dropped_column; SET search_path TO local_shard_execution_dropped_column; +GRANT ALL ON SCHEMA local_shard_execution_dropped_column TO regularuser; CREATE TABLE t1 (a int, b int, c int UNIQUE, d int, e int); ALTER TABLE t1 DROP COLUMN e; SELECT create_distributed_table('t1', 'c'); diff --git a/src/test/regress/expected/function_create.out b/src/test/regress/expected/function_create.out index 692b6080509..3e44ba9a0cc 100644 --- a/src/test/regress/expected/function_create.out +++ b/src/test/regress/expected/function_create.out @@ -1,6 +1,7 @@ \set VERBOSITY terse CREATE SCHEMA function_create; SET search_path TO function_create; +GRANT ALL ON SCHEMA function_create TO regularuser; -- helper function to verify the function of a coordinator is the same on all workers CREATE OR REPLACE FUNCTION verify_function_is_same_on_workers(funcname text) RETURNS bool diff --git a/src/test/regress/expected/index_create.out b/src/test/regress/expected/index_create.out index 4d3455ce5cd..9cacd8a9fe8 100644 --- a/src/test/regress/expected/index_create.out +++ b/src/test/regress/expected/index_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA index_create; SET search_path TO index_create; +GRANT ALL ON SCHEMA index_create TO regularuser; CREATE TABLE test_tbl (a INT NOT NULL PRIMARY KEY, b text, c BIGINT); CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a); SELECT create_distributed_table('test_tbl','a'); @@ -62,7 +63,7 @@ SELECT 'alter_idx_rename_test_3'::regclass, 'alter_idx_rename_test_idx_3'::regcl (1 row) SELECT 'alter_idx_rename_test_parted_3'::regclass, 'alter_idx_rename_test_parted_idx_3'::regclass; - regclass | regclass + regclass | regclass --------------------------------------------------------------------- alter_idx_rename_test_parted_3 | alter_idx_rename_test_parted_idx_3 (1 row) @@ -98,7 +99,7 @@ SELECT 'alter_idx_rename_test_3'::regclass, 'alter_idx_rename_test_idx_3'::regcl (1 row) SELECT 'alter_idx_rename_test_parted_3'::regclass, 'alter_idx_rename_test_parted_idx_3'::regclass; - regclass | regclass + regclass | regclass --------------------------------------------------------------------- alter_idx_rename_test_parted_3 | alter_idx_rename_test_parted_idx_3 (1 row) @@ -107,4 +108,4 @@ ALTER INDEX alter_idx_rename_test_idx_3 RENAME TO alter_idx_rename_test_idx_4; DROP INDEX alter_idx_rename_test_idx_4; DROP TABLE alter_idx_rename_test_3; DROP INDEX alter_idx_rename_test_parted_idx_3; -DROP TABLE alter_idx_rename_test_parted_3; \ No newline at end of file +DROP TABLE alter_idx_rename_test_parted_3; diff --git a/src/test/regress/expected/intermediate_result_pruning_create.out b/src/test/regress/expected/intermediate_result_pruning_create.out index 7d497266dbc..40bb87f9d19 100644 --- a/src/test/regress/expected/intermediate_result_pruning_create.out +++ b/src/test/regress/expected/intermediate_result_pruning_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA "intermediate result pruning"; SET search_path TO "intermediate result pruning"; +GRANT ALL ON SCHEMA "intermediate result pruning" TO regularuser; CREATE TABLE table_1 (key int, value text); SELECT create_distributed_table('table_1', 'key'); create_distributed_table diff --git a/src/test/regress/expected/local_dist_join_load.out b/src/test/regress/expected/local_dist_join_load.out index ce68edc8d73..e9936394130 100644 --- a/src/test/regress/expected/local_dist_join_load.out +++ b/src/test/regress/expected/local_dist_join_load.out @@ -1,5 +1,6 @@ CREATE SCHEMA local_dist_join_mixed; SET search_path TO local_dist_join_mixed; +GRANT ALL ON SCHEMA local_dist_join_mixed TO regularuser; CREATE TABLE distributed (key int, id bigserial PRIMARY KEY, name text, created_at timestamptz DEFAULT now(), b int); diff --git a/src/test/regress/expected/nested_execution_create.out b/src/test/regress/expected/nested_execution_create.out index 889f088720d..314387aa5f7 100644 --- a/src/test/regress/expected/nested_execution_create.out +++ b/src/test/regress/expected/nested_execution_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA nested_execution; SET search_path TO nested_execution; +GRANT ALL ON SCHEMA nested_execution TO regularuser; -- some of the next_execution tests change for single shard SET citus.shard_count TO 4; CREATE TABLE distributed (key int, name text, diff --git a/src/test/regress/expected/partitioned_indexes_create.out b/src/test/regress/expected/partitioned_indexes_create.out index c3ffd20badf..4902c9beca9 100644 --- a/src/test/regress/expected/partitioned_indexes_create.out +++ b/src/test/regress/expected/partitioned_indexes_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA "partitioned indexes"; SET search_path TO "partitioned indexes"; +GRANT ALL ON SCHEMA "partitioned indexes" TO regularuser; -- test with proper table CREATE TABLE dist_partitioned_table (dist_col int, another_col int, partition_col timestamp) PARTITION BY RANGE (partition_col); SELECT create_distributed_table('dist_partitioned_table', 'dist_col'); diff --git a/src/test/regress/expected/prepared_statements_create_load.out b/src/test/regress/expected/prepared_statements_create_load.out index 5e3740abe32..69039b830bd 100644 --- a/src/test/regress/expected/prepared_statements_create_load.out +++ b/src/test/regress/expected/prepared_statements_create_load.out @@ -1,5 +1,6 @@ CREATE SCHEMA "prepared statements"; SET search_path TO "prepared statements"; +GRANT ALL ON SCHEMA "prepared statements" TO regularuser; CREATE TABLE repartition_prepared_test (a int, b int); SELECT create_distributed_table('repartition_prepared_test', 'a'); create_distributed_table diff --git a/src/test/regress/expected/schemas_create.out b/src/test/regress/expected/schemas_create.out index 98292e5438a..21c84b74599 100644 --- a/src/test/regress/expected/schemas_create.out +++ b/src/test/regress/expected/schemas_create.out @@ -1,6 +1,9 @@ CREATE SCHEMA test_schema_1; +GRANT ALL ON SCHEMA test_schema_1 TO regularuser; CREATE SCHEMA IF NOT EXISTS test_schema_2; +GRANT ALL ON SCHEMA test_schema_2 TO regularuser; CREATE SCHEMA test_schema_3 CREATE TABLE test_table(a INT PRIMARY KEY); +GRANT ALL ON SCHEMA test_schema_3 TO regularuser; SELECT create_distributed_table('test_schema_3.test_table','a'); create_distributed_table --------------------------------------------------------------------- @@ -10,6 +13,7 @@ SELECT create_distributed_table('test_schema_3.test_table','a'); INSERT INTO test_schema_3.test_table VALUES (1), (2); DROP SCHEMA test_schema_2; CREATE SCHEMA test_schema_4; +GRANT ALL ON SCHEMA test_schema_4 TO regularuser; ALTER TABLE test_schema_3.test_table SET SCHEMA test_schema_4; ALTER SCHEMA test_schema_3 RENAME TO test_schema_3_renamed; ALTER SCHEMA test_schema_4 RENAME TO test_schema_5; diff --git a/src/test/regress/expected/sequences_create.out b/src/test/regress/expected/sequences_create.out index f1e3e927042..28cc113f64f 100644 --- a/src/test/regress/expected/sequences_create.out +++ b/src/test/regress/expected/sequences_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA sequences_schema; SET search_path TO sequences_schema; +GRANT ALL ON SCHEMA sequences_schema TO regularuser; CREATE SEQUENCE seq_0; ALTER SEQUENCE seq_0 AS smallint; CREATE SEQUENCE seq_1; diff --git a/src/test/regress/expected/views_create.out b/src/test/regress/expected/views_create.out index 3488516b1f2..35a811b76e6 100644 --- a/src/test/regress/expected/views_create.out +++ b/src/test/regress/expected/views_create.out @@ -1,5 +1,6 @@ CREATE SCHEMA views_create; SET search_path TO views_create; +GRANT ALL ON SCHEMA views_create TO regularuser; CREATE TABLE view_test_table(a INT NOT NULL PRIMARY KEY, b BIGINT, c text); SELECT create_distributed_table('view_test_table', 'a'); create_distributed_table @@ -62,7 +63,7 @@ SELECT COUNT(*) FROM select_all_matview; (1 row) SELECT * FROM select_filtered_matview; - a | b | c + a | b | c --------------------------------------------------------------------- 2 | 1 | views (1 row) @@ -88,10 +89,15 @@ CREATE TABLE local (id bigserial PRIMARY KEY, title text); SET client_min_messages TO ERROR; CREATE VIEW "local regular view" AS SELECT * FROM local; +GRANT ALL ON TABLE "local regular view" TO regularuser; CREATE VIEW dist_regular_view AS SELECT * FROM distributed; +GRANT ALL ON TABLE dist_regular_view TO regularuser; CREATE VIEW local_regular_view2 as SELECT count(*) FROM distributed JOIN "local regular view" USING (id); +GRANT ALL ON TABLE local_regular_view2 TO regularuser; CREATE VIEW local_regular_view3 as SELECT count(*) FROM local JOIN dist_regular_view USING (id); +GRANT ALL ON TABLE local_regular_view3 TO regularuser; CREATE VIEW "local regular view4" as SELECT count(*) as "my cny" FROM dist_regular_view JOIN "local regular view" USING (id); +GRANT ALL ON TABLE "local regular view4" TO regularuser; RESET client_min_messages; -- these above restrictions brought us to the following schema SELECT create_reference_table('reference'); diff --git a/src/test/regress/sql/arbitrary_configs_truncate_cascade_create.sql b/src/test/regress/sql/arbitrary_configs_truncate_cascade_create.sql index 332c84c5f6b..b271a5e658f 100644 --- a/src/test/regress/sql/arbitrary_configs_truncate_cascade_create.sql +++ b/src/test/regress/sql/arbitrary_configs_truncate_cascade_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA truncate_cascade_tests_schema; SET search_path TO truncate_cascade_tests_schema; +GRANT ALL ON SCHEMA truncate_cascade_tests_schema TO regularuser; -- tables connected with foreign keys CREATE TABLE table_with_pk(a bigint PRIMARY KEY); diff --git a/src/test/regress/sql/arbitrary_configs_truncate_create.sql b/src/test/regress/sql/arbitrary_configs_truncate_create.sql index 7b6f196924b..b9c82637af4 100644 --- a/src/test/regress/sql/arbitrary_configs_truncate_create.sql +++ b/src/test/regress/sql/arbitrary_configs_truncate_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA truncate_tests_schema; SET search_path TO truncate_tests_schema; +GRANT ALL ON SCHEMA truncate_tests_schema TO regularuser; -- simple table CREATE TABLE basic_table(a int); diff --git a/src/test/regress/sql/arbitrary_configs_truncate_partition_create.sql b/src/test/regress/sql/arbitrary_configs_truncate_partition_create.sql index 1e6109f151d..7738549ff93 100644 --- a/src/test/regress/sql/arbitrary_configs_truncate_partition_create.sql +++ b/src/test/regress/sql/arbitrary_configs_truncate_partition_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA truncate_partition_tests_schema; SET search_path TO truncate_partition_tests_schema; +GRANT ALL ON SCHEMA truncate_partition_tests_schema TO regularuser; -- partioned table CREATE TABLE partitioned_table(a int) PARTITION BY RANGE(a); diff --git a/src/test/regress/sql/auto_grant_all_to_regularuser.sql b/src/test/regress/sql/auto_grant_all_to_regularuser.sql new file mode 100644 index 00000000000..959d8a9faec --- /dev/null +++ b/src/test/regress/sql/auto_grant_all_to_regularuser.sql @@ -0,0 +1,5 @@ +ALTER DEFAULT PRIVILEGES GRANT ALL ON SCHEMAS TO regularuser; -- does not work with citus +ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO regularuser; -- does not work for views with citus +ALTER DEFAULT PRIVILEGES GRANT ALL ON TYPES TO regularuser; +ALTER DEFAULT PRIVILEGES GRANT ALL ON SEQUENCES TO regularuser; +ALTER DEFAULT PRIVILEGES GRANT ALL ON FUNCTIONS TO regularuser; diff --git a/src/test/regress/sql/ch_benchmarks_create_load.sql b/src/test/regress/sql/ch_benchmarks_create_load.sql index 07f895ecc2d..25e99e071ab 100644 --- a/src/test/regress/sql/ch_benchmarks_create_load.sql +++ b/src/test/regress/sql/ch_benchmarks_create_load.sql @@ -1,5 +1,6 @@ CREATE SCHEMA "ch benchmarks"; SET search_path to "ch benchmarks"; +GRANT ALL ON SCHEMA "ch benchmarks" TO regularuser; CREATE TABLE order_line ( diff --git a/src/test/regress/sql/distributed_planning_create_load.sql b/src/test/regress/sql/distributed_planning_create_load.sql index d1530cc345a..307088a063d 100644 --- a/src/test/regress/sql/distributed_planning_create_load.sql +++ b/src/test/regress/sql/distributed_planning_create_load.sql @@ -1,5 +1,6 @@ CREATE SCHEMA "distributed planning"; SET search_path TO "distributed planning"; +GRANT ALL ON SCHEMA "distributed planning" TO regularuser; CREATE TABLE date_part_table (event_time timestamp, event int, user_id int) diff --git a/src/test/regress/sql/dropped_columns_create_load.sql b/src/test/regress/sql/dropped_columns_create_load.sql index d47c264ea39..99eeae78145 100644 --- a/src/test/regress/sql/dropped_columns_create_load.sql +++ b/src/test/regress/sql/dropped_columns_create_load.sql @@ -1,5 +1,6 @@ CREATE SCHEMA local_shard_execution_dropped_column; SET search_path TO local_shard_execution_dropped_column; +GRANT ALL ON SCHEMA local_shard_execution_dropped_column TO regularuser; CREATE TABLE t1 (a int, b int, c int UNIQUE, d int, e int); ALTER TABLE t1 DROP COLUMN e; diff --git a/src/test/regress/sql/function_create.sql b/src/test/regress/sql/function_create.sql index 2973769c949..a05d803eaff 100644 --- a/src/test/regress/sql/function_create.sql +++ b/src/test/regress/sql/function_create.sql @@ -1,6 +1,7 @@ \set VERBOSITY terse CREATE SCHEMA function_create; SET search_path TO function_create; +GRANT ALL ON SCHEMA function_create TO regularuser; -- helper function to verify the function of a coordinator is the same on all workers CREATE OR REPLACE FUNCTION verify_function_is_same_on_workers(funcname text) diff --git a/src/test/regress/sql/index_create.sql b/src/test/regress/sql/index_create.sql index 9e0c0805e39..42a9b07c33f 100644 --- a/src/test/regress/sql/index_create.sql +++ b/src/test/regress/sql/index_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA index_create; SET search_path TO index_create; +GRANT ALL ON SCHEMA index_create TO regularuser; CREATE TABLE test_tbl (a INT NOT NULL PRIMARY KEY, b text, c BIGINT); CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a); diff --git a/src/test/regress/sql/intermediate_result_pruning_create.sql b/src/test/regress/sql/intermediate_result_pruning_create.sql index dd06a4986a9..611a60de3bb 100644 --- a/src/test/regress/sql/intermediate_result_pruning_create.sql +++ b/src/test/regress/sql/intermediate_result_pruning_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA "intermediate result pruning"; SET search_path TO "intermediate result pruning"; +GRANT ALL ON SCHEMA "intermediate result pruning" TO regularuser; CREATE TABLE table_1 (key int, value text); SELECT create_distributed_table('table_1', 'key'); diff --git a/src/test/regress/sql/local_dist_join_load.sql b/src/test/regress/sql/local_dist_join_load.sql index 53cc668f8a4..0bff92f9286 100644 --- a/src/test/regress/sql/local_dist_join_load.sql +++ b/src/test/regress/sql/local_dist_join_load.sql @@ -1,5 +1,6 @@ CREATE SCHEMA local_dist_join_mixed; SET search_path TO local_dist_join_mixed; +GRANT ALL ON SCHEMA local_dist_join_mixed TO regularuser; diff --git a/src/test/regress/sql/nested_execution_create.sql b/src/test/regress/sql/nested_execution_create.sql index 1c7cfa6385f..5b97bb0f5ae 100644 --- a/src/test/regress/sql/nested_execution_create.sql +++ b/src/test/regress/sql/nested_execution_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA nested_execution; SET search_path TO nested_execution; +GRANT ALL ON SCHEMA nested_execution TO regularuser; -- some of the next_execution tests change for single shard SET citus.shard_count TO 4; diff --git a/src/test/regress/sql/partitioned_indexes_create.sql b/src/test/regress/sql/partitioned_indexes_create.sql index dcb2ab37a50..6556d834a5d 100644 --- a/src/test/regress/sql/partitioned_indexes_create.sql +++ b/src/test/regress/sql/partitioned_indexes_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA "partitioned indexes"; SET search_path TO "partitioned indexes"; +GRANT ALL ON SCHEMA "partitioned indexes" TO regularuser; -- test with proper table CREATE TABLE dist_partitioned_table (dist_col int, another_col int, partition_col timestamp) PARTITION BY RANGE (partition_col); diff --git a/src/test/regress/sql/prepared_statements_create_load.sql b/src/test/regress/sql/prepared_statements_create_load.sql index 025ff1f6a72..e82319aac8c 100644 --- a/src/test/regress/sql/prepared_statements_create_load.sql +++ b/src/test/regress/sql/prepared_statements_create_load.sql @@ -1,5 +1,6 @@ CREATE SCHEMA "prepared statements"; SET search_path TO "prepared statements"; +GRANT ALL ON SCHEMA "prepared statements" TO regularuser; CREATE TABLE repartition_prepared_test (a int, b int); SELECT create_distributed_table('repartition_prepared_test', 'a'); diff --git a/src/test/regress/sql/schemas_create.sql b/src/test/regress/sql/schemas_create.sql index a50368c399b..e206978e1f8 100644 --- a/src/test/regress/sql/schemas_create.sql +++ b/src/test/regress/sql/schemas_create.sql @@ -1,12 +1,16 @@ CREATE SCHEMA test_schema_1; +GRANT ALL ON SCHEMA test_schema_1 TO regularuser; CREATE SCHEMA IF NOT EXISTS test_schema_2; +GRANT ALL ON SCHEMA test_schema_2 TO regularuser; CREATE SCHEMA test_schema_3 CREATE TABLE test_table(a INT PRIMARY KEY); +GRANT ALL ON SCHEMA test_schema_3 TO regularuser; SELECT create_distributed_table('test_schema_3.test_table','a'); INSERT INTO test_schema_3.test_table VALUES (1), (2); DROP SCHEMA test_schema_2; CREATE SCHEMA test_schema_4; +GRANT ALL ON SCHEMA test_schema_4 TO regularuser; ALTER TABLE test_schema_3.test_table SET SCHEMA test_schema_4; ALTER SCHEMA test_schema_3 RENAME TO test_schema_3_renamed; diff --git a/src/test/regress/sql/sequences_create.sql b/src/test/regress/sql/sequences_create.sql index de983e17726..e513beacdd1 100644 --- a/src/test/regress/sql/sequences_create.sql +++ b/src/test/regress/sql/sequences_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA sequences_schema; SET search_path TO sequences_schema; +GRANT ALL ON SCHEMA sequences_schema TO regularuser; CREATE SEQUENCE seq_0; ALTER SEQUENCE seq_0 AS smallint; diff --git a/src/test/regress/sql/views_create.sql b/src/test/regress/sql/views_create.sql index e2078699007..2a35d18f696 100644 --- a/src/test/regress/sql/views_create.sql +++ b/src/test/regress/sql/views_create.sql @@ -1,5 +1,6 @@ CREATE SCHEMA views_create; SET search_path TO views_create; +GRANT ALL ON SCHEMA views_create TO regularuser; CREATE TABLE view_test_table(a INT NOT NULL PRIMARY KEY, b BIGINT, c text); SELECT create_distributed_table('view_test_table', 'a'); @@ -51,11 +52,16 @@ CREATE TABLE local (id bigserial PRIMARY KEY, title text); SET client_min_messages TO ERROR; CREATE VIEW "local regular view" AS SELECT * FROM local; +GRANT ALL ON TABLE "local regular view" TO regularuser; CREATE VIEW dist_regular_view AS SELECT * FROM distributed; +GRANT ALL ON TABLE dist_regular_view TO regularuser; CREATE VIEW local_regular_view2 as SELECT count(*) FROM distributed JOIN "local regular view" USING (id); +GRANT ALL ON TABLE local_regular_view2 TO regularuser; CREATE VIEW local_regular_view3 as SELECT count(*) FROM local JOIN dist_regular_view USING (id); +GRANT ALL ON TABLE local_regular_view3 TO regularuser; CREATE VIEW "local regular view4" as SELECT count(*) as "my cny" FROM dist_regular_view JOIN "local regular view" USING (id); +GRANT ALL ON TABLE "local regular view4" TO regularuser; RESET client_min_messages; -- these above restrictions brought us to the following schema