mirror of https://github.com/citusdata/citus.git
Add a config to our test suite for non owning users
This would have found the bug that's fixed in #5441pull/5442/head
parent
aaaf637a6b
commit
bb430fa0c7
|
@ -34,7 +34,7 @@ testResults = {}
|
||||||
parallel_thread_amount = 1
|
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(
|
return common.run_pg_regress_without_exit(
|
||||||
config.bindir,
|
config.bindir,
|
||||||
config.pg_srcdir,
|
config.pg_srcdir,
|
||||||
|
@ -42,7 +42,7 @@ def _run_pg_regress_on_port(config, port, schedule_name, extra_tests=""):
|
||||||
schedule_name,
|
schedule_name,
|
||||||
config.output_dir,
|
config.output_dir,
|
||||||
config.input_dir,
|
config.input_dir,
|
||||||
config.user,
|
user,
|
||||||
extra_tests,
|
extra_tests,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -54,12 +54,11 @@ def run_for_config(config, lock, sql_schedule_name):
|
||||||
common.initialize_citus_cluster(
|
common.initialize_citus_cluster(
|
||||||
config.bindir, config.datadir, config.settings, config
|
config.bindir, config.datadir, config.settings, config
|
||||||
)
|
)
|
||||||
if config.user == cfg.REGULAR_USER_NAME:
|
common.create_role(
|
||||||
common.create_role(
|
config.bindir,
|
||||||
config.bindir,
|
config.node_name_to_ports.values(),
|
||||||
config.node_name_to_ports.values(),
|
cfg.REGULAR_USER_NAME,
|
||||||
config.user,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
copy_copy_modified_binary(config.datadir)
|
copy_copy_modified_binary(config.datadir)
|
||||||
copy_test_files(config)
|
copy_test_files(config)
|
||||||
|
@ -91,20 +90,25 @@ def run_for_config(config, lock, sql_schedule_name):
|
||||||
)
|
)
|
||||||
|
|
||||||
exitCode |= _run_pg_regress_on_port(
|
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)
|
common.save_regression_diff("create", config.output_dir)
|
||||||
|
|
||||||
extra_tests = os.getenv("EXTRA_TESTS", "")
|
extra_tests = os.getenv("EXTRA_TESTS", "")
|
||||||
if config.is_mx and config.worker_amount > 0:
|
if config.is_mx and config.worker_amount > 0:
|
||||||
exitCode |= _run_pg_regress_on_port(
|
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:
|
else:
|
||||||
exitCode |= _run_pg_regress_on_port(
|
exitCode |= _run_pg_regress_on_port(
|
||||||
config,
|
config,
|
||||||
config.coordinator_port(),
|
config.coordinator_port(),
|
||||||
sql_schedule_name,
|
sql_schedule_name,
|
||||||
|
config.user,
|
||||||
extra_tests=extra_tests,
|
extra_tests=extra_tests,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,12 @@ class CitusBaseClusterConfig(object, metaclass=NewInitCaller):
|
||||||
self.pg_srcdir = arguments["--pgxsdir"]
|
self.pg_srcdir = arguments["--pgxsdir"]
|
||||||
self.temp_dir = CITUS_ARBITRARY_TEST_DIR
|
self.temp_dir = CITUS_ARBITRARY_TEST_DIR
|
||||||
self.worker_amount = 2
|
self.worker_amount = 2
|
||||||
|
# User is that will execute the sql scripts
|
||||||
self.user = REGULAR_USER_NAME
|
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.dbname = DATABASE_NAME
|
||||||
self.is_mx = True
|
self.is_mx = True
|
||||||
self.is_citus = True
|
self.is_citus = True
|
||||||
|
@ -129,6 +134,8 @@ class CitusBaseClusterConfig(object, metaclass=NewInitCaller):
|
||||||
self.output_file = os.path.join(self.datadir, "run.out")
|
self.output_file = os.path.join(self.datadir, "run.out")
|
||||||
if self.worker_amount > 0:
|
if self.worker_amount > 0:
|
||||||
self.chosen_random_worker_port = self.random_worker_port()
|
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)
|
self.settings.update(self.new_settings)
|
||||||
|
|
||||||
def coordinator_port(self):
|
def coordinator_port(self):
|
||||||
|
@ -177,6 +184,11 @@ class CitusDefaultClusterConfig(CitusBaseClusterConfig):
|
||||||
"arbitrary_configs_alter_table_add_constraint_without_name",
|
"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):
|
class CitusUpgradeConfig(CitusBaseClusterConfig):
|
||||||
def __init__(self, arguments, pre_tar, post_tar):
|
def __init__(self, arguments, pre_tar, post_tar):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
test: auto_grant_all_to_regularuser
|
||||||
test: intermediate_result_pruning_create
|
test: intermediate_result_pruning_create
|
||||||
test: prepared_statements_create_load ch_benchmarks_create_load
|
test: prepared_statements_create_load ch_benchmarks_create_load
|
||||||
test: dropped_columns_create_load distributed_planning_create_load
|
test: dropped_columns_create_load distributed_planning_create_load
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA truncate_cascade_tests_schema;
|
CREATE SCHEMA truncate_cascade_tests_schema;
|
||||||
SET search_path TO 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
|
-- tables connected with foreign keys
|
||||||
CREATE TABLE table_with_pk(a bigint PRIMARY KEY);
|
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));
|
CREATE TABLE table_with_fk_1(a bigint, b bigint, FOREIGN KEY (b) REFERENCES table_with_pk(a));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA truncate_tests_schema;
|
CREATE SCHEMA truncate_tests_schema;
|
||||||
SET search_path TO truncate_tests_schema;
|
SET search_path TO truncate_tests_schema;
|
||||||
|
GRANT ALL ON SCHEMA truncate_tests_schema TO regularuser;
|
||||||
-- simple table
|
-- simple table
|
||||||
CREATE TABLE basic_table(a int);
|
CREATE TABLE basic_table(a int);
|
||||||
-- partioned table
|
-- partioned table
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA truncate_partition_tests_schema;
|
CREATE SCHEMA truncate_partition_tests_schema;
|
||||||
SET search_path TO truncate_partition_tests_schema;
|
SET search_path TO truncate_partition_tests_schema;
|
||||||
|
GRANT ALL ON SCHEMA truncate_partition_tests_schema TO regularuser;
|
||||||
-- partioned table
|
-- partioned table
|
||||||
CREATE TABLE partitioned_table(a int) PARTITION BY RANGE(a);
|
CREATE TABLE partitioned_table(a int) PARTITION BY RANGE(a);
|
||||||
CREATE TABLE partitioned_table_0 PARTITION OF partitioned_table
|
CREATE TABLE partitioned_table_0 PARTITION OF partitioned_table
|
||||||
|
|
|
@ -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;
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "ch benchmarks";
|
CREATE SCHEMA "ch benchmarks";
|
||||||
SET search_path to "ch benchmarks";
|
SET search_path to "ch benchmarks";
|
||||||
|
GRANT ALL ON SCHEMA "ch benchmarks" TO regularuser;
|
||||||
CREATE TABLE order_line (
|
CREATE TABLE order_line (
|
||||||
ol_w_id int NOT NULL,
|
ol_w_id int NOT NULL,
|
||||||
ol_d_id int NOT NULL,
|
ol_d_id int NOT NULL,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "distributed planning";
|
CREATE SCHEMA "distributed planning";
|
||||||
SET search_path TO "distributed planning";
|
SET search_path TO "distributed planning";
|
||||||
|
GRANT ALL ON SCHEMA "distributed planning" TO regularuser;
|
||||||
CREATE TABLE
|
CREATE TABLE
|
||||||
date_part_table (event_time timestamp, event int, user_id int)
|
date_part_table (event_time timestamp, event int, user_id int)
|
||||||
partition by range (event_time);
|
partition by range (event_time);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA local_shard_execution_dropped_column;
|
CREATE SCHEMA local_shard_execution_dropped_column;
|
||||||
SET search_path TO 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);
|
CREATE TABLE t1 (a int, b int, c int UNIQUE, d int, e int);
|
||||||
ALTER TABLE t1 DROP COLUMN e;
|
ALTER TABLE t1 DROP COLUMN e;
|
||||||
SELECT create_distributed_table('t1', 'c');
|
SELECT create_distributed_table('t1', 'c');
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
CREATE SCHEMA function_create;
|
CREATE SCHEMA function_create;
|
||||||
SET search_path TO 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
|
-- 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)
|
CREATE OR REPLACE FUNCTION verify_function_is_same_on_workers(funcname text)
|
||||||
RETURNS bool
|
RETURNS bool
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA index_create;
|
CREATE SCHEMA index_create;
|
||||||
SET search_path TO 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 TABLE test_tbl (a INT NOT NULL PRIMARY KEY, b text, c BIGINT);
|
||||||
CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a);
|
CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a);
|
||||||
SELECT create_distributed_table('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)
|
(1 row)
|
||||||
|
|
||||||
SELECT 'alter_idx_rename_test_parted_3'::regclass, 'alter_idx_rename_test_parted_idx_3'::regclass;
|
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
|
alter_idx_rename_test_parted_3 | alter_idx_rename_test_parted_idx_3
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -98,7 +99,7 @@ SELECT 'alter_idx_rename_test_3'::regclass, 'alter_idx_rename_test_idx_3'::regcl
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT 'alter_idx_rename_test_parted_3'::regclass, 'alter_idx_rename_test_parted_idx_3'::regclass;
|
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
|
alter_idx_rename_test_parted_3 | alter_idx_rename_test_parted_idx_3
|
||||||
(1 row)
|
(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 INDEX alter_idx_rename_test_idx_4;
|
||||||
DROP TABLE alter_idx_rename_test_3;
|
DROP TABLE alter_idx_rename_test_3;
|
||||||
DROP INDEX alter_idx_rename_test_parted_idx_3;
|
DROP INDEX alter_idx_rename_test_parted_idx_3;
|
||||||
DROP TABLE alter_idx_rename_test_parted_3;
|
DROP TABLE alter_idx_rename_test_parted_3;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "intermediate result pruning";
|
CREATE SCHEMA "intermediate result pruning";
|
||||||
SET search_path TO "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);
|
CREATE TABLE table_1 (key int, value text);
|
||||||
SELECT create_distributed_table('table_1', 'key');
|
SELECT create_distributed_table('table_1', 'key');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA local_dist_join_mixed;
|
CREATE SCHEMA local_dist_join_mixed;
|
||||||
SET search_path TO 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,
|
CREATE TABLE distributed (key int, id bigserial PRIMARY KEY,
|
||||||
name text,
|
name text,
|
||||||
created_at timestamptz DEFAULT now(), b int);
|
created_at timestamptz DEFAULT now(), b int);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA nested_execution;
|
CREATE SCHEMA nested_execution;
|
||||||
SET search_path TO 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
|
-- some of the next_execution tests change for single shard
|
||||||
SET citus.shard_count TO 4;
|
SET citus.shard_count TO 4;
|
||||||
CREATE TABLE distributed (key int, name text,
|
CREATE TABLE distributed (key int, name text,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "partitioned indexes";
|
CREATE SCHEMA "partitioned indexes";
|
||||||
SET search_path TO "partitioned indexes";
|
SET search_path TO "partitioned indexes";
|
||||||
|
GRANT ALL ON SCHEMA "partitioned indexes" TO regularuser;
|
||||||
-- test with proper table
|
-- test with proper table
|
||||||
CREATE TABLE dist_partitioned_table (dist_col int, another_col int, partition_col timestamp) PARTITION BY RANGE (partition_col);
|
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');
|
SELECT create_distributed_table('dist_partitioned_table', 'dist_col');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "prepared statements";
|
CREATE SCHEMA "prepared statements";
|
||||||
SET search_path TO "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);
|
CREATE TABLE repartition_prepared_test (a int, b int);
|
||||||
SELECT create_distributed_table('repartition_prepared_test', 'a');
|
SELECT create_distributed_table('repartition_prepared_test', 'a');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
CREATE SCHEMA test_schema_1;
|
CREATE SCHEMA test_schema_1;
|
||||||
|
GRANT ALL ON SCHEMA test_schema_1 TO regularuser;
|
||||||
CREATE SCHEMA IF NOT EXISTS test_schema_2;
|
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);
|
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');
|
SELECT create_distributed_table('test_schema_3.test_table','a');
|
||||||
create_distributed_table
|
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);
|
INSERT INTO test_schema_3.test_table VALUES (1), (2);
|
||||||
DROP SCHEMA test_schema_2;
|
DROP SCHEMA test_schema_2;
|
||||||
CREATE SCHEMA test_schema_4;
|
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 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_3 RENAME TO test_schema_3_renamed;
|
||||||
ALTER SCHEMA test_schema_4 RENAME TO test_schema_5;
|
ALTER SCHEMA test_schema_4 RENAME TO test_schema_5;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA sequences_schema;
|
CREATE SCHEMA sequences_schema;
|
||||||
SET search_path TO sequences_schema;
|
SET search_path TO sequences_schema;
|
||||||
|
GRANT ALL ON SCHEMA sequences_schema TO regularuser;
|
||||||
CREATE SEQUENCE seq_0;
|
CREATE SEQUENCE seq_0;
|
||||||
ALTER SEQUENCE seq_0 AS smallint;
|
ALTER SEQUENCE seq_0 AS smallint;
|
||||||
CREATE SEQUENCE seq_1;
|
CREATE SEQUENCE seq_1;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA views_create;
|
CREATE SCHEMA views_create;
|
||||||
SET search_path TO 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);
|
CREATE TABLE view_test_table(a INT NOT NULL PRIMARY KEY, b BIGINT, c text);
|
||||||
SELECT create_distributed_table('view_test_table', 'a');
|
SELECT create_distributed_table('view_test_table', 'a');
|
||||||
create_distributed_table
|
create_distributed_table
|
||||||
|
@ -62,7 +63,7 @@ SELECT COUNT(*) FROM select_all_matview;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM select_filtered_matview;
|
SELECT * FROM select_filtered_matview;
|
||||||
a | b | c
|
a | b | c
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
2 | 1 | views
|
2 | 1 | views
|
||||||
(1 row)
|
(1 row)
|
||||||
|
@ -88,10 +89,15 @@ CREATE TABLE local (id bigserial PRIMARY KEY,
|
||||||
title text);
|
title text);
|
||||||
SET client_min_messages TO ERROR;
|
SET client_min_messages TO ERROR;
|
||||||
CREATE VIEW "local regular view" AS SELECT * FROM local;
|
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;
|
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);
|
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);
|
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);
|
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;
|
RESET client_min_messages;
|
||||||
-- these above restrictions brought us to the following schema
|
-- these above restrictions brought us to the following schema
|
||||||
SELECT create_reference_table('reference');
|
SELECT create_reference_table('reference');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA truncate_cascade_tests_schema;
|
CREATE SCHEMA truncate_cascade_tests_schema;
|
||||||
SET search_path TO 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
|
-- tables connected with foreign keys
|
||||||
CREATE TABLE table_with_pk(a bigint PRIMARY KEY);
|
CREATE TABLE table_with_pk(a bigint PRIMARY KEY);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA truncate_tests_schema;
|
CREATE SCHEMA truncate_tests_schema;
|
||||||
SET search_path TO truncate_tests_schema;
|
SET search_path TO truncate_tests_schema;
|
||||||
|
GRANT ALL ON SCHEMA truncate_tests_schema TO regularuser;
|
||||||
|
|
||||||
-- simple table
|
-- simple table
|
||||||
CREATE TABLE basic_table(a int);
|
CREATE TABLE basic_table(a int);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA truncate_partition_tests_schema;
|
CREATE SCHEMA truncate_partition_tests_schema;
|
||||||
SET search_path TO truncate_partition_tests_schema;
|
SET search_path TO truncate_partition_tests_schema;
|
||||||
|
GRANT ALL ON SCHEMA truncate_partition_tests_schema TO regularuser;
|
||||||
|
|
||||||
-- partioned table
|
-- partioned table
|
||||||
CREATE TABLE partitioned_table(a int) PARTITION BY RANGE(a);
|
CREATE TABLE partitioned_table(a int) PARTITION BY RANGE(a);
|
||||||
|
|
|
@ -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;
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "ch benchmarks";
|
CREATE SCHEMA "ch benchmarks";
|
||||||
SET search_path to "ch benchmarks";
|
SET search_path to "ch benchmarks";
|
||||||
|
GRANT ALL ON SCHEMA "ch benchmarks" TO regularuser;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE order_line (
|
CREATE TABLE order_line (
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "distributed planning";
|
CREATE SCHEMA "distributed planning";
|
||||||
SET search_path TO "distributed planning";
|
SET search_path TO "distributed planning";
|
||||||
|
GRANT ALL ON SCHEMA "distributed planning" TO regularuser;
|
||||||
|
|
||||||
CREATE TABLE
|
CREATE TABLE
|
||||||
date_part_table (event_time timestamp, event int, user_id int)
|
date_part_table (event_time timestamp, event int, user_id int)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA local_shard_execution_dropped_column;
|
CREATE SCHEMA local_shard_execution_dropped_column;
|
||||||
SET search_path TO 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);
|
CREATE TABLE t1 (a int, b int, c int UNIQUE, d int, e int);
|
||||||
ALTER TABLE t1 DROP COLUMN e;
|
ALTER TABLE t1 DROP COLUMN e;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
\set VERBOSITY terse
|
\set VERBOSITY terse
|
||||||
CREATE SCHEMA function_create;
|
CREATE SCHEMA function_create;
|
||||||
SET search_path TO 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
|
-- 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)
|
CREATE OR REPLACE FUNCTION verify_function_is_same_on_workers(funcname text)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA index_create;
|
CREATE SCHEMA index_create;
|
||||||
SET search_path TO 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 TABLE test_tbl (a INT NOT NULL PRIMARY KEY, b text, c BIGINT);
|
||||||
CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a);
|
CREATE UNIQUE INDEX CONCURRENTLY a_index ON test_tbl (a);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "intermediate result pruning";
|
CREATE SCHEMA "intermediate result pruning";
|
||||||
SET search_path TO "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);
|
CREATE TABLE table_1 (key int, value text);
|
||||||
SELECT create_distributed_table('table_1', 'key');
|
SELECT create_distributed_table('table_1', 'key');
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA local_dist_join_mixed;
|
CREATE SCHEMA local_dist_join_mixed;
|
||||||
SET search_path TO local_dist_join_mixed;
|
SET search_path TO local_dist_join_mixed;
|
||||||
|
GRANT ALL ON SCHEMA local_dist_join_mixed TO regularuser;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA nested_execution;
|
CREATE SCHEMA nested_execution;
|
||||||
SET search_path TO 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
|
-- some of the next_execution tests change for single shard
|
||||||
SET citus.shard_count TO 4;
|
SET citus.shard_count TO 4;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "partitioned indexes";
|
CREATE SCHEMA "partitioned indexes";
|
||||||
SET search_path TO "partitioned indexes";
|
SET search_path TO "partitioned indexes";
|
||||||
|
GRANT ALL ON SCHEMA "partitioned indexes" TO regularuser;
|
||||||
|
|
||||||
-- test with proper table
|
-- test with proper table
|
||||||
CREATE TABLE dist_partitioned_table (dist_col int, another_col int, partition_col timestamp) PARTITION BY RANGE (partition_col);
|
CREATE TABLE dist_partitioned_table (dist_col int, another_col int, partition_col timestamp) PARTITION BY RANGE (partition_col);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA "prepared statements";
|
CREATE SCHEMA "prepared statements";
|
||||||
SET search_path TO "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);
|
CREATE TABLE repartition_prepared_test (a int, b int);
|
||||||
SELECT create_distributed_table('repartition_prepared_test', 'a');
|
SELECT create_distributed_table('repartition_prepared_test', 'a');
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
CREATE SCHEMA test_schema_1;
|
CREATE SCHEMA test_schema_1;
|
||||||
|
GRANT ALL ON SCHEMA test_schema_1 TO regularuser;
|
||||||
CREATE SCHEMA IF NOT EXISTS test_schema_2;
|
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);
|
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');
|
SELECT create_distributed_table('test_schema_3.test_table','a');
|
||||||
INSERT INTO test_schema_3.test_table VALUES (1), (2);
|
INSERT INTO test_schema_3.test_table VALUES (1), (2);
|
||||||
|
|
||||||
DROP SCHEMA test_schema_2;
|
DROP SCHEMA test_schema_2;
|
||||||
CREATE SCHEMA test_schema_4;
|
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 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_3 RENAME TO test_schema_3_renamed;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA sequences_schema;
|
CREATE SCHEMA sequences_schema;
|
||||||
SET search_path TO sequences_schema;
|
SET search_path TO sequences_schema;
|
||||||
|
GRANT ALL ON SCHEMA sequences_schema TO regularuser;
|
||||||
|
|
||||||
CREATE SEQUENCE seq_0;
|
CREATE SEQUENCE seq_0;
|
||||||
ALTER SEQUENCE seq_0 AS smallint;
|
ALTER SEQUENCE seq_0 AS smallint;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
CREATE SCHEMA views_create;
|
CREATE SCHEMA views_create;
|
||||||
SET search_path TO 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);
|
CREATE TABLE view_test_table(a INT NOT NULL PRIMARY KEY, b BIGINT, c text);
|
||||||
SELECT create_distributed_table('view_test_table', 'a');
|
SELECT create_distributed_table('view_test_table', 'a');
|
||||||
|
@ -51,11 +52,16 @@ CREATE TABLE local (id bigserial PRIMARY KEY,
|
||||||
title text);
|
title text);
|
||||||
SET client_min_messages TO ERROR;
|
SET client_min_messages TO ERROR;
|
||||||
CREATE VIEW "local regular view" AS SELECT * FROM local;
|
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;
|
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);
|
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);
|
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);
|
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;
|
RESET client_min_messages;
|
||||||
|
|
||||||
-- these above restrictions brought us to the following schema
|
-- these above restrictions brought us to the following schema
|
||||||
|
|
Loading…
Reference in New Issue