diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-03-15 17:08:51 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-03-15 17:09:04 -0400 |
commit | b15a8c963268153416bc67b210d6ad2a31ef58ca (patch) | |
tree | c8bf82b9e658dbd4c8487fa7794fdd27c7e4efaf /src | |
parent | 12bcecae10f7986407fedeb3dd795556027a9d96 (diff) | |
download | postgresql-b15a8c963268153416bc67b210d6ad2a31ef58ca.tar.gz postgresql-b15a8c963268153416bc67b210d6ad2a31ef58ca.zip |
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 7421f4b8 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 7421f4b8 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
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/with.out | 2 | ||||
-rw-r--r-- | src/test/regress/sql/with.sql | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/test/regress/expected/with.out b/src/test/regress/expected/with.out index 3e2b34c6fcd..0646451fb0b 100644 --- a/src/test/regress/expected/with.out +++ b/src/test/regress/expected/with.out @@ -2280,7 +2280,7 @@ LINE 1: WITH test AS (SELECT 42) INSERT INTO test VALUES (1); -- check response to attempt to modify table with same name as a CTE (perhaps -- surprisingly it works, because CTEs don't hide tables from data-modifying -- statements) -create table test (i int); +create temp table test (i int); with test as (select 42) insert into test select * from test; select * from test; i diff --git a/src/test/regress/sql/with.sql b/src/test/regress/sql/with.sql index baf65488a8e..512ff1b3ba2 100644 --- a/src/test/regress/sql/with.sql +++ b/src/test/regress/sql/with.sql @@ -1035,7 +1035,7 @@ WITH test AS (SELECT 42) INSERT INTO test VALUES (1); -- check response to attempt to modify table with same name as a CTE (perhaps -- surprisingly it works, because CTEs don't hide tables from data-modifying -- statements) -create table test (i int); +create temp table test (i int); with test as (select 42) insert into test select * from test; select * from test; drop table test; |