Hi, With unlucky scheduling you can get a failure like this:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=hoverfly&dt=2021-12-22%2010%3A51%3A32 Suggested fix attached.
From 3991f040e9c9afc4d7cfd4980b5f27f4113dbd1f Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.mu...@gmail.com> Date: Thu, 30 Dec 2021 14:43:57 +1300 Subject: [PATCH] Fix racy "with" test. with.sql asserted that there was no table "test", but alter_table.sql creates and drops such a table and might run at the same time. Use a unique name. Per build farm. Back-patch all the way. --- src/test/regress/expected/with.out | 16 ++++++++-------- src/test/regress/sql/with.sql | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/test/regress/expected/with.out b/src/test/regress/expected/with.out index 75e61460d9..f15ece3bd1 100644 --- a/src/test/regress/expected/with.out +++ b/src/test/regress/expected/with.out @@ -3149,19 +3149,19 @@ with ordinality as (select 1 as x) select * from ordinality; (1 row) -- check sane response to attempt to modify CTE relation -WITH test AS (SELECT 42) INSERT INTO test VALUES (1); -ERROR: relation "test" does not exist -LINE 1: WITH test AS (SELECT 42) INSERT INTO test VALUES (1); - ^ +WITH with_test AS (SELECT 42) INSERT INTO with_test VALUES (1); +ERROR: relation "with_test" does not exist +LINE 1: WITH with_test AS (SELECT 42) INSERT INTO with_test VALUES (... + ^ -- 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 temp table test (i int); -with test as (select 42) insert into test select * from test; -select * from test; +create temp table with_test (i int); +with with_test as (select 42) insert into with_test select * from with_test; +select * from with_test; i ---- 42 (1 row) -drop table test; +drop table with_test; diff --git a/src/test/regress/sql/with.sql b/src/test/regress/sql/with.sql index 46668a903e..7ff9de97a5 100644 --- a/src/test/regress/sql/with.sql +++ b/src/test/regress/sql/with.sql @@ -1459,12 +1459,12 @@ create table foo (with ordinality); -- fail, WITH is a reserved word with ordinality as (select 1 as x) select * from ordinality; -- check sane response to attempt to modify CTE relation -WITH test AS (SELECT 42) INSERT INTO test VALUES (1); +WITH with_test AS (SELECT 42) INSERT INTO with_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 temp table test (i int); -with test as (select 42) insert into test select * from test; -select * from test; -drop table test; +create temp table with_test (i int); +with with_test as (select 42) insert into with_test select * from with_test; +select * from with_test; +drop table with_test; -- 2.30.2