Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2a679ae

Browse filesBrowse files
committed
Fix regression tests conflict in 3ca43db
3ca43db adds regression tests with permission checks. The conflict has been observed at buildfarm member piculet. This commit fixes the conflict in the following way. 1. partition_split.sql now uses role names regress_partition_split_alice and regress_partition_split_bob (it mistakenly used regress_partition_merge_alice and regress_partition_merge_bob before). 2. Permissions on schemas partitions_merge_schema and partition_split_schema are granted to corresponding roles. Before, the lack of permissions led to the creation of objects in the public schema and potential conflict. Reported-by: Daniel Gustafsson Discussion: https://postgr.es/m/03A07EF6-98D2-419B-A3AA-A111C64CC207%40yesql.se
1 parent 6f8bb7c commit 2a679ae
Copy full SHA for 2a679ae

File tree

4 files changed

+38
-20
lines changed
Filter options

4 files changed

+38
-20
lines changed

‎src/test/regress/expected/partition_merge.out

Copy file name to clipboardExpand all lines: src/test/regress/expected/partition_merge.out
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,8 @@ DROP ACCESS METHOD partitions_merge_heap;
883883
-- the merging partitions to do the merge.
884884
CREATE ROLE regress_partition_merge_alice;
885885
CREATE ROLE regress_partition_merge_bob;
886+
GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partition_merge_alice;
887+
GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partition_merge_bob;
886888
SET SESSION AUTHORIZATION regress_partition_merge_alice;
887889
CREATE TABLE t (i int) PARTITION BY RANGE (i);
888890
CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
@@ -906,6 +908,8 @@ SET SESSION AUTHORIZATION regress_partition_merge_bob;
906908
ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
907909
RESET SESSION AUTHORIZATION;
908910
DROP TABLE t;
911+
REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_alice;
912+
REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_bob;
909913
DROP ROLE regress_partition_merge_alice;
910914
DROP ROLE regress_partition_merge_bob;
911915
RESET search_path;

‎src/test/regress/expected/partition_split.out

Copy file name to clipboardExpand all lines: src/test/regress/expected/partition_split.out
+15-10Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,33 +1516,38 @@ DROP TABLE t;
15161516
DROP ACCESS METHOD partition_split_heap;
15171517
-- Test permission checks. The user needs to own the parent table and the
15181518
-- the partition to split to do the split.
1519-
CREATE ROLE regress_partition_merge_alice;
1520-
CREATE ROLE regress_partition_merge_bob;
1521-
SET SESSION AUTHORIZATION regress_partition_merge_alice;
1519+
CREATE ROLE regress_partition_split_alice;
1520+
CREATE ROLE regress_partition_split_bob;
1521+
GRANT ALL ON SCHEMA partition_split_schema TO regress_partition_split_alice;
1522+
GRANT ALL ON SCHEMA partition_split_schema TO regress_partition_split_bob;
1523+
SET SESSION AUTHORIZATION regress_partition_split_alice;
15221524
CREATE TABLE t (i int) PARTITION BY RANGE (i);
15231525
CREATE TABLE tp_0_2 PARTITION OF t FOR VALUES FROM (0) TO (2);
1524-
SET SESSION AUTHORIZATION regress_partition_merge_bob;
1526+
SET SESSION AUTHORIZATION regress_partition_split_bob;
15251527
ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
15261528
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
15271529
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
15281530
ERROR: must be owner of table t
15291531
RESET SESSION AUTHORIZATION;
1530-
ALTER TABLE t OWNER TO regress_partition_merge_bob;
1531-
SET SESSION AUTHORIZATION regress_partition_merge_bob;
1532+
ALTER TABLE t OWNER TO regress_partition_split_bob;
1533+
SET SESSION AUTHORIZATION regress_partition_split_bob;
15321534
ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
15331535
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
15341536
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
15351537
ERROR: must be owner of table tp_0_2
15361538
RESET SESSION AUTHORIZATION;
1537-
ALTER TABLE tp_0_2 OWNER TO regress_partition_merge_bob;
1538-
SET SESSION AUTHORIZATION regress_partition_merge_bob;
1539+
ALTER TABLE tp_0_2 OWNER TO regress_partition_split_bob;
1540+
SET SESSION AUTHORIZATION regress_partition_split_bob;
15391541
ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
15401542
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
15411543
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
15421544
RESET SESSION AUTHORIZATION;
15431545
DROP TABLE t;
1544-
DROP ROLE regress_partition_merge_alice;
1545-
DROP ROLE regress_partition_merge_bob;
1546+
REVOKE ALL ON SCHEMA partition_split_schema FROM regress_partition_split_alice;
1547+
REVOKE ALL ON SCHEMA partition_split_schema FROM regress_partition_split_bob;
1548+
DROP ROLE regress_partition_split_alice;
1549+
DROP ROLE regress_partition_split_bob;
1550+
RESET search_path;
15461551
--
15471552
DROP SCHEMA partition_split_schema;
15481553
DROP SCHEMA partition_split_schema2;

‎src/test/regress/sql/partition_merge.sql

Copy file name to clipboardExpand all lines: src/test/regress/sql/partition_merge.sql
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ DROP ACCESS METHOD partitions_merge_heap;
553553
-- the merging partitions to do the merge.
554554
CREATE ROLE regress_partition_merge_alice;
555555
CREATE ROLE regress_partition_merge_bob;
556+
GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partition_merge_alice;
557+
GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partition_merge_bob;
556558

557559
SET SESSION AUTHORIZATION regress_partition_merge_alice;
558560
CREATE TABLE t (i int) PARTITION BY RANGE (i);
@@ -579,6 +581,8 @@ ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
579581
RESET SESSION AUTHORIZATION;
580582

581583
DROP TABLE t;
584+
REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_alice;
585+
REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_bob;
582586
DROP ROLE regress_partition_merge_alice;
583587
DROP ROLE regress_partition_merge_bob;
584588

‎src/test/regress/sql/partition_split.sql

Copy file name to clipboardExpand all lines: src/test/regress/sql/partition_split.sql
+15-10Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -896,37 +896,42 @@ DROP ACCESS METHOD partition_split_heap;
896896

897897
-- Test permission checks. The user needs to own the parent table and the
898898
-- the partition to split to do the split.
899-
CREATE ROLE regress_partition_merge_alice;
900-
CREATE ROLE regress_partition_merge_bob;
899+
CREATE ROLE regress_partition_split_alice;
900+
CREATE ROLE regress_partition_split_bob;
901+
GRANT ALL ON SCHEMA partition_split_schema TO regress_partition_split_alice;
902+
GRANT ALL ON SCHEMA partition_split_schema TO regress_partition_split_bob;
901903

902-
SET SESSION AUTHORIZATION regress_partition_merge_alice;
904+
SET SESSION AUTHORIZATION regress_partition_split_alice;
903905
CREATE TABLE t (i int) PARTITION BY RANGE (i);
904906
CREATE TABLE tp_0_2 PARTITION OF t FOR VALUES FROM (0) TO (2);
905907

906-
SET SESSION AUTHORIZATION regress_partition_merge_bob;
908+
SET SESSION AUTHORIZATION regress_partition_split_bob;
907909
ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
908910
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
909911
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
910912
RESET SESSION AUTHORIZATION;
911913

912-
ALTER TABLE t OWNER TO regress_partition_merge_bob;
913-
SET SESSION AUTHORIZATION regress_partition_merge_bob;
914+
ALTER TABLE t OWNER TO regress_partition_split_bob;
915+
SET SESSION AUTHORIZATION regress_partition_split_bob;
914916
ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
915917
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
916918
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
917919
RESET SESSION AUTHORIZATION;
918920

919-
ALTER TABLE tp_0_2 OWNER TO regress_partition_merge_bob;
920-
SET SESSION AUTHORIZATION regress_partition_merge_bob;
921+
ALTER TABLE tp_0_2 OWNER TO regress_partition_split_bob;
922+
SET SESSION AUTHORIZATION regress_partition_split_bob;
921923
ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
922924
(PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
923925
PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
924926
RESET SESSION AUTHORIZATION;
925927

926928
DROP TABLE t;
927-
DROP ROLE regress_partition_merge_alice;
928-
DROP ROLE regress_partition_merge_bob;
929+
REVOKE ALL ON SCHEMA partition_split_schema FROM regress_partition_split_alice;
930+
REVOKE ALL ON SCHEMA partition_split_schema FROM regress_partition_split_bob;
931+
DROP ROLE regress_partition_split_alice;
932+
DROP ROLE regress_partition_split_bob;
929933

934+
RESET search_path;
930935

931936
--
932937
DROP SCHEMA partition_split_schema;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.