Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commitfb7db40

Browse files
committed
Clean up duplicate role and schema names in regression tests.
Since these names are global, using the same ones in different regressiontests creates a hazard of test failures if any two such scripts runconcurrently. Let's establish a policy of not doing that. In the caseswhere a conflict existed, I chose to rename both sides: in principle onescript or the other could've been left in possession of the common name,but that seems to just invite more trouble of the same sort.There are a number of places where scripts are using names that seemunduly generic, but in the absence of actual conflicts I left them alone.In addition, fix insert.sql's use of "someone_else" as a role name.That's a flat out violation of longstanding project policy, so back-patchthat change to v10 where the usage appeared. The rest of this is justfuture-proofing, as no two of these scripts are actually run concurrentlyin the existing parallel_schedule.Conflicts of schema-qualified names also exist, but will be dealt withseparately.Discussion:https://postgr.es/m/4627.1521070268@sss.pgh.pa.us
1 parent3a4b891 commitfb7db40

18 files changed

+864
-864
lines changed

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

Lines changed: 153 additions & 153 deletions
Large diffs are not rendered by default.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
--
44
-- Clean up in case a prior regression run failed
55
SET client_min_messages TO 'warning';
6-
DROP ROLE IF EXISTSregress_alter_user1;
6+
DROP ROLE IF EXISTSregress_alter_table_user1;
77
RESET client_min_messages;
8-
CREATE USERregress_alter_user1;
8+
CREATE USERregress_alter_table_user1;
99
--
1010
-- add attribute
1111
--
@@ -216,14 +216,14 @@ ALTER INDEX IF EXISTS __tmp_onek_unique1 RENAME TO onek_unique1;
216216
NOTICE: relation "__tmp_onek_unique1" does not exist, skipping
217217
ALTER INDEX onek_unique1 RENAME TO tmp_onek_unique1;
218218
ALTER INDEX tmp_onek_unique1 RENAME TO onek_unique1;
219-
SET ROLEregress_alter_user1;
219+
SET ROLEregress_alter_table_user1;
220220
ALTER INDEX onek_unique1 RENAME TO fail; -- permission denied
221221
ERROR: must be owner of index onek_unique1
222222
RESET ROLE;
223223
-- renaming views
224224
CREATE VIEW tmp_view (unique1) AS SELECT unique1 FROM tenk1;
225225
ALTER TABLE tmp_view RENAME TO tmp_view_new;
226-
SET ROLEregress_alter_user1;
226+
SET ROLEregress_alter_table_user1;
227227
ALTER VIEW tmp_view_new RENAME TO fail; -- permission denied
228228
ERROR: must be owner of view tmp_view_new
229229
RESET ROLE;
@@ -3890,4 +3890,4 @@ ALTER TABLE tmp ALTER COLUMN i SET (n_distinct = 1, n_distinct_inherited = 2);
38903890
ALTER TABLE tmp ALTER COLUMN i RESET (n_distinct_inherited);
38913891
ANALYZE tmp;
38923892
DROP TABLE tmp;
3893-
DROP USERregress_alter_user1;
3893+
DROP USERregress_alter_table_user1;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ ERROR: testfunc1(integer) is not a procedure
129129
DROP PROCEDURE nonexistent();
130130
ERROR: procedure nonexistent() does not exist
131131
-- privileges
132-
CREATE USERregress_user1;
133-
GRANT INSERT ON cp_test TOregress_user1;
132+
CREATE USERregress_cp_user1;
133+
GRANT INSERT ON cp_test TOregress_cp_user1;
134134
REVOKE EXECUTE ON PROCEDURE ptest1(text) FROM PUBLIC;
135-
SET ROLEregress_user1;
135+
SET ROLEregress_cp_user1;
136136
CALL ptest1('a'); -- error
137137
ERROR: permission denied for procedure ptest1
138138
RESET ROLE;
139-
GRANT EXECUTE ON PROCEDURE ptest1(text) TOregress_user1;
140-
SET ROLEregress_user1;
139+
GRANT EXECUTE ON PROCEDURE ptest1(text) TOregress_cp_user1;
140+
SET ROLEregress_cp_user1;
141141
CALL ptest1('a'); -- ok
142142
RESET ROLE;
143143
-- ROUTINE syntax
@@ -150,4 +150,4 @@ DROP ROUTINE testfunc1(int);
150150
DROP PROCEDURE ptest1;
151151
DROP PROCEDURE ptest2;
152152
DROP TABLE cp_test;
153-
DROP USERregress_user1;
153+
DROP USERregress_cp_user1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ CREATE VIEW temp_view_test.v3_temp AS SELECT * FROM temp_table;
8383
NOTICE: view "v3_temp" will be a temporary view
8484
ERROR: cannot create temporary relation in non-temporary schema
8585
-- should fail
86-
CREATE SCHEMAtest_schema
86+
CREATE SCHEMAtest_view_schema
8787
CREATE TEMP VIEW testview AS SELECT 1;
8888
ERROR: cannot create temporary relation in non-temporary schema
8989
-- joins: if any of the join relations are temporary, the view

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,10 @@ ALTER TABLE itest7 ALTER COLUMN a SET GENERATED BY DEFAULT;
360360
ALTER TABLE itest7 ALTER COLUMN a RESTART;
361361
ALTER TABLE itest7 ALTER COLUMN a DROP IDENTITY;
362362
-- privileges
363-
CREATE USERregress_user1;
363+
CREATE USERregress_identity_user1;
364364
CREATE TABLE itest8 (a int GENERATED ALWAYS AS IDENTITY, b text);
365-
GRANT SELECT, INSERT ON itest8 TOregress_user1;
366-
SET ROLEregress_user1;
365+
GRANT SELECT, INSERT ON itest8 TOregress_identity_user1;
366+
SET ROLEregress_identity_user1;
367367
INSERT INTO itest8 DEFAULT VALUES;
368368
SELECT * FROM itest8;
369369
a | b
@@ -373,7 +373,7 @@ SELECT * FROM itest8;
373373

374374
RESET ROLE;
375375
DROP TABLE itest8;
376-
DROP USERregress_user1;
376+
DROP USERregress_identity_user1;
377377
-- typed tables (currently not supported)
378378
CREATE TYPE itest_type AS (f1 integer, f2 text, f3 bigint);
379379
CREATE TABLE itest12 OF itest_type (f1 WITH OPTIONS GENERATED ALWAYS AS IDENTITY); -- error

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -619,16 +619,16 @@ select tableoid::regclass, * from mlparted_def;
619619
-- appropriate key description (or none) in various situations
620620
create table key_desc (a int, b int) partition by list ((a+0));
621621
create table key_desc_1 partition of key_desc for values in (1) partition by range (b);
622-
create usersomeone_else;
623-
grant select (a) on key_desc_1 tosomeone_else;
624-
grant insert on key_desc tosomeone_else;
625-
set rolesomeone_else;
622+
create userregress_insert_other_user;
623+
grant select (a) on key_desc_1 toregress_insert_other_user;
624+
grant insert on key_desc toregress_insert_other_user;
625+
set roleregress_insert_other_user;
626626
-- no key description is shown
627627
insert into key_desc values (1, 1);
628628
ERROR: no partition of relation "key_desc_1" found for row
629629
reset role;
630-
grant select (b) on key_desc_1 tosomeone_else;
631-
set rolesomeone_else;
630+
grant select (b) on key_desc_1 toregress_insert_other_user;
631+
set roleregress_insert_other_user;
632632
-- key description (b)=(1) is now shown
633633
insert into key_desc values (1, 1);
634634
ERROR: no partition of relation "key_desc_1" found for row
@@ -637,9 +637,9 @@ DETAIL: Partition key of the failing row contains (b) = (1).
637637
insert into key_desc values (2, 1);
638638
ERROR: no partition of relation "key_desc" found for row
639639
reset role;
640-
revoke all on key_desc fromsomeone_else;
641-
revoke all on key_desc_1 fromsomeone_else;
642-
drop rolesomeone_else;
640+
revoke all on key_desc fromregress_insert_other_user;
641+
revoke all on key_desc_1 fromregress_insert_other_user;
642+
drop roleregress_insert_other_user;
643643
drop table key_desc, key_desc_1;
644644
-- test minvalue/maxvalue restrictions
645645
create table mcrparted (a int, b int, c int) partition by range (a, abs(b), c);

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--
22
-- Regression tests for schemas (namespaces)
33
--
4-
CREATE SCHEMAtest_schema_1
4+
CREATE SCHEMAtest_ns_schema_1
55
CREATE UNIQUE INDEX abc_a_idx ON abc (a)
66
CREATE VIEW abc_view AS
77
SELECT a+1 AS a, b+1 AS b FROM abc
@@ -11,59 +11,59 @@ CREATE SCHEMA test_schema_1
1111
);
1212
-- verify that the objects were created
1313
SELECT COUNT(*) FROM pg_class WHERE relnamespace =
14-
(SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_1');
14+
(SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
1515
count
1616
-------
1717
5
1818
(1 row)
1919

20-
INSERT INTOtest_schema_1.abc DEFAULT VALUES;
21-
INSERT INTOtest_schema_1.abc DEFAULT VALUES;
22-
INSERT INTOtest_schema_1.abc DEFAULT VALUES;
23-
SELECT * FROMtest_schema_1.abc;
20+
INSERT INTOtest_ns_schema_1.abc DEFAULT VALUES;
21+
INSERT INTOtest_ns_schema_1.abc DEFAULT VALUES;
22+
INSERT INTOtest_ns_schema_1.abc DEFAULT VALUES;
23+
SELECT * FROMtest_ns_schema_1.abc;
2424
a | b
2525
---+---
2626
1 |
2727
2 |
2828
3 |
2929
(3 rows)
3030

31-
SELECT * FROMtest_schema_1.abc_view;
31+
SELECT * FROMtest_ns_schema_1.abc_view;
3232
a | b
3333
---+---
3434
2 |
3535
3 |
3636
4 |
3737
(3 rows)
3838

39-
ALTER SCHEMAtest_schema_1 RENAME TOtest_schema_renamed;
39+
ALTER SCHEMAtest_ns_schema_1 RENAME TOtest_ns_schema_renamed;
4040
SELECT COUNT(*) FROM pg_class WHERE relnamespace =
41-
(SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_1');
41+
(SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
4242
count
4343
-------
4444
0
4545
(1 row)
4646

4747
-- test IF NOT EXISTS cases
48-
CREATE SCHEMAtest_schema_renamed; -- fail, already exists
49-
ERROR: schema "test_schema_renamed" already exists
50-
CREATE SCHEMA IF NOT EXISTStest_schema_renamed; -- ok with notice
51-
NOTICE: schema "test_schema_renamed" already exists, skipping
52-
CREATE SCHEMA IF NOT EXISTStest_schema_renamed -- fail, disallowed
48+
CREATE SCHEMAtest_ns_schema_renamed; -- fail, already exists
49+
ERROR: schema "test_ns_schema_renamed" already exists
50+
CREATE SCHEMA IF NOT EXISTStest_ns_schema_renamed; -- ok with notice
51+
NOTICE: schema "test_ns_schema_renamed" already exists, skipping
52+
CREATE SCHEMA IF NOT EXISTStest_ns_schema_renamed -- fail, disallowed
5353
CREATE TABLE abc (
5454
a serial,
5555
b int UNIQUE
5656
);
5757
ERROR: CREATE SCHEMA IF NOT EXISTS cannot include schema elements
5858
LINE 2: CREATE TABLE abc (
5959
^
60-
DROP SCHEMAtest_schema_renamed CASCADE;
60+
DROP SCHEMAtest_ns_schema_renamed CASCADE;
6161
NOTICE: drop cascades to 2 other objects
62-
DETAIL: drop cascades to tabletest_schema_renamed.abc
63-
drop cascades to viewtest_schema_renamed.abc_view
62+
DETAIL: drop cascades to tabletest_ns_schema_renamed.abc
63+
drop cascades to viewtest_ns_schema_renamed.abc_view
6464
-- verify that the objects were dropped
6565
SELECT COUNT(*) FROM pg_class WHERE relnamespace =
66-
(SELECT oid FROM pg_namespace WHERE nspname = 'test_schema_renamed');
66+
(SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_renamed');
6767
count
6868
-------
6969
0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp