Fix unstable tests in partition_merge.sql and partition_split.sql.
authorFujii Masao <[email protected]>
Mon, 15 Jul 2024 05:09:30 +0000 (14:09 +0900)
committerFujii Masao <[email protected]>
Mon, 15 Jul 2024 05:11:13 +0000 (14:11 +0900)
The tests added by commit c086896625 were unstable due to
missing schema names when checking pg_tables and pg_indexes.

Backpatch to v17.

Reported by buildfarm.

src/test/regress/expected/partition_merge.out
src/test/regress/expected/partition_split.out
src/test/regress/sql/partition_merge.sql
src/test/regress/sql/partition_split.sql

index 26bf58b23db43ada71df0d1961ea915fc45a768f..59836e2d35e1ee4df913fdc22f77ea1e6366a3f8 100644 (file)
@@ -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, 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
index 1a8c95ad819835d3190163e8202808d3c21c53df..dc9a5130cccb9ac4cde782950eaa269473c81f7f 100644 (file)
@@ -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
index 200bd3e762092511e031f87e623853ee7340cd8b..bede819af942ee8a99ce017326d9a3d6d7bc6f37 100644 (file)
@@ -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, 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
index 5143d85ec01cae1aa7ad6e263553ad46a26f7a5c..ef5ea07f7400bb49859acdbdb777084dabb06501 100644 (file)
@@ -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