pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marina Polyakova <m.polyakova@postgrespro.ru>
To: pgsql-hackers@postgresql.org
To: exclusion@gmail.com
Subject: Conflict between regression tests namespace & transactions due to recent changes
Date: Mon, 15 May 2023 18:27:29 +0300
Message-ID: <80d0201636665d82185942e7112257b4@postgrespro.ru> (raw)

Hello, hackers!

When running tests for version 15, we found a conflict between 
regression tests namespace & transactions due to recent changes [1].

diff -w -U3 .../src/test/regress/expected/transactions.out 
.../src/bin/pg_upgrade/tmp_check/results/transactions.out
--- .../src/test/regress/expected/transactions.out ...
+++ .../src/bin/pg_upgrade/tmp_check/results/transactions.out ...
@@ -899,6 +899,9 @@

  RESET default_transaction_read_only;
  DROP TABLE abc;
+ERROR:  cannot drop table abc because other objects depend on it
+DETAIL:  view test_ns_schema_2.abc_view depends on table abc
+HINT:  Use DROP ... CASCADE to drop the dependent objects too.
  -- Test assorted behaviors around the implicit transaction block 
created
  -- when multiple SQL commands are sent in a single Query message.  
These
  -- tests rely on the fact that psql will not break SQL commands apart 
at a
...

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.

ISTM the patch diff.patch fixes this problem...

[1] 
https://github.com/postgres/postgres/commit/dbd5795e7539ec9e15c0d4ed2d05b1b18d2a3b09

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

Attachments:

  [text/x-diff] diff.patch (2.0K, ../80d0201636665d82185942e7112257b4@postgrespro.ru/2-diff.patch)
  download | inline diff:
diff --git a/src/test/regress/expected/namespace.out b/src/test/regress/expected/namespace.out
index a62fd8ded015e6ee56784e4341e5ac1a4ed5621f..bcb6a75cf230fdc30f728201c2a2baef1838ed18 100644
--- a/src/test/regress/expected/namespace.out
+++ b/src/test/regress/expected/namespace.out
@@ -35,10 +35,15 @@ SHOW search_path;
 
 -- verify that the correct search_path preserved
 -- after creating the schema and on commit
+-- create your table to not use the same table from transactions test
 BEGIN;
 SET search_path to public, test_ns_schema_1;
 CREATE SCHEMA test_ns_schema_2
-       CREATE VIEW abc_view AS SELECT a FROM abc;
+       CREATE VIEW abc_view AS SELECT a FROM abc
+       CREATE TABLE abc (
+              a serial,
+              b int UNIQUE
+       );
 SHOW search_path;
        search_path        
 --------------------------
@@ -53,7 +58,9 @@ SHOW search_path;
 (1 row)
 
 DROP SCHEMA test_ns_schema_2 CASCADE;
-NOTICE:  drop cascades to view test_ns_schema_2.abc_view
+NOTICE:  drop cascades to 2 other objects
+DETAIL:  drop cascades to table test_ns_schema_2.abc
+drop cascades to view test_ns_schema_2.abc_view
 -- verify that the objects were created
 SELECT COUNT(*) FROM pg_class WHERE relnamespace =
     (SELECT oid FROM pg_namespace WHERE nspname = 'test_ns_schema_1');
diff --git a/src/test/regress/sql/namespace.sql b/src/test/regress/sql/namespace.sql
index 3474f5ecf4215068fd89ec52f9ee8b95ddff36bb..95b9ed7b00807222e94e30221348f58039c63257 100644
--- a/src/test/regress/sql/namespace.sql
+++ b/src/test/regress/sql/namespace.sql
@@ -28,10 +28,16 @@ SHOW search_path;
 
 -- verify that the correct search_path preserved
 -- after creating the schema and on commit
+-- create your table to not use the same table from transactions test
 BEGIN;
 SET search_path to public, test_ns_schema_1;
 CREATE SCHEMA test_ns_schema_2
-       CREATE VIEW abc_view AS SELECT a FROM abc;
+       CREATE VIEW abc_view AS SELECT a FROM abc
+
+       CREATE TABLE abc (
+              a serial,
+              b int UNIQUE
+       );
 SHOW search_path;
 COMMIT;
 SHOW search_path;


view thread (12+ messages)  latest in thread

Message-ID: <80d0201636665d82185942e7112257b4@postgrespro.ru>
Permalink:  ../80d0201636665d82185942e7112257b4@postgrespro.ru/
Also on:    postgresql.org/message-id/80d0201636665d82185942e7112257b4@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, exclusion@gmail.com
  Subject: Re: Conflict between regression tests namespace & transactions due to recent changes
  In-Reply-To: <80d0201636665d82185942e7112257b4@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