pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marina Polyakova <m.polyakova@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>
Cc: exclusion@gmail.com
Subject: Re: Conflict between regression tests namespace & transactions due to recent changes
Date: Mon, 15 May 2023 23:23:18 +0300
Message-ID: <f62cd65e1b179783521f424a42ef3b27@postgrespro.ru> (raw)
In-Reply-To: <2165312.1684167368@sss.pgh.pa.us>
References: <80d0201636665d82185942e7112257b4@postgrespro.ru>
	<2165312.1684167368@sss.pgh.pa.us>

On 2023-05-15 19:16, Tom Lane wrote:
> Marina Polyakova <m.polyakova@postgrespro.ru> writes:
>> IIUC the conflict was caused by
> 
>> +SET search_path to public, test_ns_schema_1;
>> +CREATE SCHEMA test_ns_schema_2
>> +       CREATE VIEW abc_view AS SELECT a FROM abc;
> 
>> because the parallel regression test transactions had already created
>> the table abc and was trying to drop it.
> 
> Hmm.  I'd actually fix the blame on transactions.sql here.  Creating
> a table named as generically as "abc" is horribly bad practice in
> a set of concurrent tests.  namespace.sql is arguably okay, since
> it's creating that table name in a private schema.
> 
> I'd be inclined to fix this by doing s/abc/something-else/g in
> transactions.sql.
> 
> 			regards, tom lane

Maybe use a separate schema for all new objects in the transaction 
test?.. See diff_set_tx_schema.patch.

-- 
Marina Polyakova
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachments:

  [text/x-diff] diff_set_tx_schema.patch (1.1K, ../f62cd65e1b179783521f424a42ef3b27@postgrespro.ru/2-diff_set_tx_schema.patch)
  download | inline diff:
diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out
index 2b2cff7d9120a139532d1a6a2f2bc79e463bc4fa..6a3758bafb54327fbe341dfd89457e53ffce47dd 100644
--- a/src/test/regress/expected/transactions.out
+++ b/src/test/regress/expected/transactions.out
@@ -1,6 +1,10 @@
 --
 -- TRANSACTIONS
 --
+-- Use your schema to avoid conflicts with objects with the same names in
+-- parallel tests.
+CREATE SCHEMA test_tx_schema;
+SET search_path TO test_tx_schema,public;
 BEGIN;
 CREATE TABLE xacttest (a smallint, b real);
 INSERT INTO xacttest VALUES
diff --git a/src/test/regress/sql/transactions.sql b/src/test/regress/sql/transactions.sql
index 7ee5f6aaa55a686f5484664c3fae224c08bde42a..0e6d6453edaa776425524d43abf5ae3cfca3ac45 100644
--- a/src/test/regress/sql/transactions.sql
+++ b/src/test/regress/sql/transactions.sql
@@ -2,6 +2,11 @@
 -- TRANSACTIONS
 --
 
+-- Use your schema to avoid conflicts with objects with the same names in
+-- parallel tests.
+CREATE SCHEMA test_tx_schema;
+SET search_path TO test_tx_schema,public;
+
 BEGIN;
 
 CREATE TABLE xacttest (a smallint, b real);


view thread (12+ messages)  latest in thread

Message-ID: <f62cd65e1b179783521f424a42ef3b27@postgrespro.ru>
Permalink:  ../f62cd65e1b179783521f424a42ef3b27@postgrespro.ru/
Also on:    postgresql.org/message-id/f62cd65e1b179783521f424a42ef3b27@postgrespro.ru

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: m.polyakova@postgrespro.ru, tgl@sss.pgh.pa.us, noah@leadboat.com, exclusion@gmail.com
  Subject: Re: Conflict between regression tests namespace & transactions due to recent changes
  In-Reply-To: <f62cd65e1b179783521f424a42ef3b27@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox