Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2cf8c7a

Browse files
committed
Clean up duplicate table and function names in regression tests.
Many of the objects we create during the regression tests are put in the public schema, so that using the same names in different regression tests creates a hazard of test failures if any two such scripts run concurrently. This patch cleans up a bunch of latent hazards of that sort, as well as two live hazards. The current situation in this regard is far worse than it was a year or two back, because practically all of the partitioning-related test cases have reused table names with enthusiasm. I despaired of cleaning up that mess within the five most-affected tests (create_table, alter_table, insert, update, inherit); fortunately those don't run concurrently. Other than partitioning problems, most of the issues boil down to using names like "foo", "bar", "tmp", etc, without thought for the fact that other test scripts might use similar names concurrently. I've made an effort to make all such names more specific. One of the live hazards was that commit 7421f4b caused with.sql to create a table named "test", conflicting with a similarly-named table in alter_table.sql; this was exposed in the buildfarm recently. The other one was that join.sql and transactions.sql both create tables named "foo" and "bar"; but join.sql's uses of those names date back only to December or so. Since commit 7421f4b was back-patched to v10, back-patch a minimal fix for that problem. The rest of this is just future-proofing. Discussion: https://postgr.es/m/4627.1521070268@sss.pgh.pa.us
1 parent 1466bcf commit 2cf8c7a

32 files changed

+2210
-2210
lines changed

src/test/regress/expected/alter_table.out

+228-228
Large diffs are not rendered by default.

src/test/regress/expected/create_procedure.out

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ERROR: random() is not a procedure
88
LINE 1: CALL random();
99
^
1010
HINT: To call a function, use SELECT.
11-
CREATE FUNCTION testfunc1(a int) RETURNS int LANGUAGE SQL AS $$ SELECT a $$;
11+
CREATE FUNCTION cp_testfunc1(a int) RETURNS int LANGUAGE SQL AS $$ SELECT a $$;
1212
CREATE TABLE cp_test (a int, b text);
1313
CREATE PROCEDURE ptest1(x text)
1414
LANGUAGE SQL
@@ -118,14 +118,14 @@ LINE 1: ALTER PROCEDURE ptest1(text) STRICT;
118118
^
119119
ALTER FUNCTION ptest1(text) VOLATILE; -- error: not a function
120120
ERROR: ptest1(text) is not a function
121-
ALTER PROCEDURE testfunc1(int) VOLATILE; -- error: not a procedure
122-
ERROR: testfunc1(integer) is not a procedure
121+
ALTER PROCEDURE cp_testfunc1(int) VOLATILE; -- error: not a procedure
122+
ERROR: cp_testfunc1(integer) is not a procedure
123123
ALTER PROCEDURE nonexistent() VOLATILE;
124124
ERROR: procedure nonexistent() does not exist
125125
DROP FUNCTION ptest1(text); -- error: not a function
126126
ERROR: ptest1(text) is not a function
127-
DROP PROCEDURE testfunc1(int); -- error: not a procedure
128-
ERROR: testfunc1(integer) is not a procedure
127+
DROP PROCEDURE cp_testfunc1(int); -- error: not a procedure
128+
ERROR: cp_testfunc1(integer) is not a procedure
129129
DROP PROCEDURE nonexistent();
130130
ERROR: procedure nonexistent() does not exist
131131
-- privileges
@@ -141,11 +141,11 @@ SET ROLE regress_cp_user1;
141141
CALL ptest1('a'); -- ok
142142
RESET ROLE;
143143
-- ROUTINE syntax
144-
ALTER ROUTINE testfunc1(int) RENAME TO testfunc1a;
145-
ALTER ROUTINE testfunc1a RENAME TO testfunc1;
144+
ALTER ROUTINE cp_testfunc1(int) RENAME TO cp_testfunc1a;
145+
ALTER ROUTINE cp_testfunc1a RENAME TO cp_testfunc1;
146146
ALTER ROUTINE ptest1(text) RENAME TO ptest1a;
147147
ALTER ROUTINE ptest1a RENAME TO ptest1;
148-
DROP ROUTINE testfunc1(int);
148+
DROP ROUTINE cp_testfunc1(int);
149149
-- cleanup
150150
DROP PROCEDURE ptest1;
151151
DROP PROCEDURE ptest2;

0 commit comments

Comments
 (0)