On 2024/07/15 13:33, Fujii Masao wrote:


On 2024/07/12 21:17, Masahiko Sawada wrote:
On Thu, Jul 11, 2024 at 8:14 PM Fujii Masao <masao.fu...@oss.nttdata.com> wrote:



On 2024/07/10 22:35, Masahiko Sawada wrote:
BTW the new regression tests don't check the table and index names.
Isn't it better to show table and index names for better
diagnosability?

Sounds good to me. I've updated the patch as suggested.
Please see the attached patch.


Thank you for updating the patch! LGTM.

Thanks for reviewing the patch! I've pushed it.

However, some buildfarm members reported errors, so I'll investigate further.

Attached patch fixes unstable tests. Currently testing before pushing.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
From 8da2a15b9777783be06abe08f838ab01bfc0e492 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fu...@postgresql.org>
Date: Mon, 15 Jul 2024 13:55:51 +0900
Subject: [PATCH] Fix unstable tests in partition_merge.sql and
 partition_split.sql.

The tests added by commit c086896625 were unstable due to
missing schema names when checking pg_tables and pg_indexes.

Reported by buildfarm.
---
 src/test/regress/expected/partition_merge.out | 7 +++++--
 src/test/regress/expected/partition_split.out | 6 ++++--
 src/test/regress/sql/partition_merge.sql      | 7 +++++--
 src/test/regress/sql/partition_split.sql      | 6 ++++--
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/test/regress/expected/partition_merge.out 
b/src/test/regress/expected/partition_merge.out
index 26bf58b23d..2b6e92f892 100644
--- a/src/test/regress/expected/partition_merge.out
+++ b/src/test/regress/expected/partition_merge.out
@@ -862,13 +862,15 @@ SET search_path = partitions_merge_schema, pg_temp, 
public;
 ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
 ROLLBACK;
 -- Check the new partition inherits parent's tablespace
+SET search_path = partitions_merge_schema, pg_temp, public;
 CREATE TABLE t (i int PRIMARY KEY USING INDEX TABLESPACE regress_tblspace)
   PARTITION BY RANGE (i) TABLESPACE regress_tblspace;
 CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
 CREATE TABLE tp_1_2 PARTITION OF t FOR VALUES FROM (1) TO (2);
 ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
 SELECT tablename, tablespace FROM pg_tables
-  WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename, tablespace;
+  WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
+  ORDER BY tablename, tablespace;
  tablename |    tablespace    
 -----------+------------------
  t         | regress_tblspace
@@ -876,7 +878,8 @@ SELECT tablename, tablespace FROM pg_tables
 (2 rows)
 
 SELECT tablename, indexname, tablespace FROM pg_indexes
-  WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename, indexname, tablespace;
+  WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
+  ORDER BY tablename, indexname, tablespace;
  tablename |  indexname  |    tablespace    
 -----------+-------------+------------------
  t         | t_pkey      | regress_tblspace
diff --git a/src/test/regress/expected/partition_split.out 
b/src/test/regress/expected/partition_split.out
index 1a8c95ad81..dc9a5130cc 100644
--- a/src/test/regress/expected/partition_split.out
+++ b/src/test/regress/expected/partition_split.out
@@ -1502,7 +1502,8 @@ ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
   (PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
    PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
 SELECT tablename, tablespace FROM pg_tables
-  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, tablespace;
+  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 
'partition_split_schema'
+  ORDER BY tablename, tablespace;
  tablename |    tablespace    
 -----------+------------------
  t         | regress_tblspace
@@ -1511,7 +1512,8 @@ SELECT tablename, tablespace FROM pg_tables
 (3 rows)
 
 SELECT tablename, indexname, tablespace FROM pg_indexes
-  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, indexname, 
tablespace;
+  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 
'partition_split_schema'
+  ORDER BY tablename, indexname, tablespace;
  tablename |  indexname  |    tablespace    
 -----------+-------------+------------------
  t         | t_pkey      | regress_tblspace
diff --git a/src/test/regress/sql/partition_merge.sql 
b/src/test/regress/sql/partition_merge.sql
index 200bd3e762..6feceeef6c 100644
--- a/src/test/regress/sql/partition_merge.sql
+++ b/src/test/regress/sql/partition_merge.sql
@@ -537,15 +537,18 @@ ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO 
tp_0_2;
 ROLLBACK;
 
 -- Check the new partition inherits parent's tablespace
+SET search_path = partitions_merge_schema, pg_temp, public;
 CREATE TABLE t (i int PRIMARY KEY USING INDEX TABLESPACE regress_tblspace)
   PARTITION BY RANGE (i) TABLESPACE regress_tblspace;
 CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
 CREATE TABLE tp_1_2 PARTITION OF t FOR VALUES FROM (1) TO (2);
 ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
 SELECT tablename, tablespace FROM pg_tables
-  WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename, tablespace;
+  WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
+  ORDER BY tablename, tablespace;
 SELECT tablename, indexname, tablespace FROM pg_indexes
-  WHERE tablename IN ('t', 'tp_0_2') ORDER BY tablename, indexname, tablespace;
+  WHERE tablename IN ('t', 'tp_0_2') AND schemaname = 'partitions_merge_schema'
+  ORDER BY tablename, indexname, tablespace;
 DROP TABLE t;
 
 -- Check the new partition inherits parent's table access method
diff --git a/src/test/regress/sql/partition_split.sql 
b/src/test/regress/sql/partition_split.sql
index 5143d85ec0..ef5ea07f74 100644
--- a/src/test/regress/sql/partition_split.sql
+++ b/src/test/regress/sql/partition_split.sql
@@ -888,9 +888,11 @@ ALTER TABLE t SPLIT PARTITION tp_0_2 INTO
   (PARTITION tp_0_1 FOR VALUES FROM (0) TO (1),
    PARTITION tp_1_2 FOR VALUES FROM (1) TO (2));
 SELECT tablename, tablespace FROM pg_tables
-  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, tablespace;
+  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 
'partition_split_schema'
+  ORDER BY tablename, tablespace;
 SELECT tablename, indexname, tablespace FROM pg_indexes
-  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') ORDER BY tablename, indexname, 
tablespace;
+  WHERE tablename IN ('t', 'tp_0_1', 'tp_1_2') AND schemaname = 
'partition_split_schema'
+  ORDER BY tablename, indexname, tablespace;
 DROP TABLE t;
 
 -- Check new partitions inherits parent's table access method
-- 
2.45.2

Reply via email to