v53-0001-refactor-src-test-regress-sql-partition_merge.sql.no-cfbot

application/octet-stream

Filename: v53-0001-refactor-src-test-regress-sql-partition_merge.sql.no-cfbot
Type: application/octet-stream
Part: 0
Message: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
From 1adf882c6971282d90ed62e26b5106ce3b034ffa Mon Sep 17 00:00:00 2001
From: jian he <jian.universality@gmail.com>
Date: Fri, 29 Aug 2025 15:34:18 +0800
Subject: [PATCH v53 1/1] refactor src/test/regress/sql/partition_merge.sql

also minor refactror getAttributesList
---
 src/backend/commands/tablecmds.c              |  20 ++--
 src/test/regress/expected/partition_merge.out | 101 ++++++++----------
 src/test/regress/sql/partition_merge.sql      |  46 ++++----
 3 files changed, 72 insertions(+), 95 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 5a3c53d3e59..8fa1a377a14 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -22120,7 +22120,7 @@ buildExpressionExecutionStates(AlteredTableInfo *tab, Relation newPartRel, EStat
 				 * We already expanded virtual expression in
 				 * createTableConstraints.
 				 */
-				con->qualstate = ExecPrepareExpr((Expr *) expand_generated_columns_in_expr(con->qual, newPartRel, 1), estate);
+				con->qualstate = ExecPrepareExpr((Expr *) con->qual, estate);
 				break;
 			case CONSTR_NOTNULL:
 				/* Nothing to do here. */
@@ -22211,27 +22211,23 @@ getAttributesList(Relation parent_rel)
 
 		def->is_not_null = attribute->attnotnull;
 
-		/* Copy identity for new partition. */
+		/* Copy identity */
 		def->identity = attribute->attidentity;
 
-		/* Add to column list */
-		colList = lappend(colList, def);
-
-		/*
-		 * Although we don't transfer the column's default/generation
-		 * expression now, we need to mark it GENERATED if appropriate.
-		 */
-		if (attribute->atthasdef && attribute->attgenerated)
-			def->generated = attribute->attgenerated;
+		/* Copy attgenerated */
+		def->generated = attribute->attgenerated;
 
 		def->storage = attribute->attstorage;
 
-		/* Likewise, copy compression if requested */
+		/* Likewise, copy compression */
 		if (CompressionMethodIsValid(attribute->attcompression))
 			def->compression =
 				pstrdup(GetCompressionMethodName(attribute->attcompression));
 		else
 			def->compression = NULL;
+
+		/* Add to column list */
+		colList = lappend(colList, def);
 	}
 
 	return colList;
diff --git a/src/test/regress/expected/partition_merge.out b/src/test/regress/expected/partition_merge.out
index f62622f8ac9..69f866721fe 100644
--- a/src/test/regress/expected/partition_merge.out
+++ b/src/test/regress/expected/partition_merge.out
@@ -144,13 +144,9 @@ SELECT * FROM pg_indexes WHERE tablename = 'sales_feb_mar_apr2022' and schemanam
  partitions_merge_schema2 | sales_feb_mar_apr2022 | sales_feb_mar_apr2022_sales_date_idx |            | CREATE INDEX sales_feb_mar_apr2022_sales_date_idx ON partitions_merge_schema2.sales_feb_mar_apr2022 USING btree (sales_date)
 (1 row)
 
-SELECT tableoid::regclass, * FROM sales_range ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_range ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
                     tableoid                    | salesperson_id | salesperson_name | sales_amount | sales_date 
 ------------------------------------------------+----------------+------------------+--------------+------------
- sales_jan2022                                  |              1 | May              |         1000 | 01-31-2022
- sales_jan2022                                  |             10 | Halder           |          350 | 01-28-2022
- sales_jan2022                                  |             13 | Gandi            |          377 | 01-09-2022
- sales_others                                   |             14 | Smith            |          510 | 05-04-2022
  partitions_merge_schema2.sales_feb_mar_apr2022 |              2 | Smirnoff         |          500 | 02-10-2022
  partitions_merge_schema2.sales_feb_mar_apr2022 |              3 | Ford             |         2000 | 04-30-2022
  partitions_merge_schema2.sales_feb_mar_apr2022 |              4 | Ivanov           |          750 | 04-13-2022
@@ -161,6 +157,10 @@ SELECT tableoid::regclass, * FROM sales_range ORDER BY tableoid, salesperson_id;
  partitions_merge_schema2.sales_feb_mar_apr2022 |              9 | Muller           |          250 | 03-11-2022
  partitions_merge_schema2.sales_feb_mar_apr2022 |             11 | Trump            |          380 | 04-06-2022
  partitions_merge_schema2.sales_feb_mar_apr2022 |             12 | Plato            |          350 | 03-19-2022
+ sales_jan2022                                  |              1 | May              |         1000 | 01-31-2022
+ sales_jan2022                                  |             10 | Halder           |          350 | 01-28-2022
+ sales_jan2022                                  |             13 | Gandi            |          377 | 01-09-2022
+ sales_others                                   |             14 | Smith            |          510 | 05-04-2022
 (14 rows)
 
 -- Use indexscan for testing indexes
@@ -437,7 +437,7 @@ INSERT INTO sales_range VALUES
   (12, 'Plato',    350,  '2022-03-19'),
   (13, 'Gandi',    377,  '2022-01-09'),
   (14, 'Smith',    510,  '2022-05-04');
-SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
       tableoid       | salesperson_id | salesperson_name | sales_amount | sales_date 
 ---------------------+----------------+------------------+--------------+------------
  sales_apr2022_01_10 |              5 | Deev             |          250 | 04-07-2022
@@ -447,7 +447,7 @@ SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid, salesperson_i
 (4 rows)
 
 ALTER TABLE sales_apr2022 MERGE PARTITIONS (sales_apr2022_01_10, sales_apr2022_10_20, sales_apr2022_20_30) INTO sales_apr_all;
-SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
    tableoid    | salesperson_id | salesperson_name | sales_amount | sales_date 
 ---------------+----------------+------------------+--------------+------------
  sales_apr_all |              3 | Ford             |         2000 | 04-30-2022
@@ -549,13 +549,9 @@ EXECUTE get_partition_info('{sales_list}');
  sales_others | p              | r       | f                | DEFAULT
 (3 rows)
 
-SELECT tableoid::regclass, * FROM sales_list ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_list ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
   tableoid  | salesperson_id | salesperson_name |  sales_state   | sales_amount | sales_date 
 ------------+----------------+------------------+----------------+--------------+------------
- sales_nord |              3 | Ford             | St. Petersburg |         2000 | 03-05-2022
- sales_nord |              7 | May              | Helsinki       |         1200 | 03-06-2022
- sales_nord |              9 | May              | Helsinki       |         1200 | 03-11-2022
- sales_nord |             10 | Halder           | Oslo           |          800 | 03-02-2022
  sales_all  |              1 | Trump            | Bejing         |         1000 | 03-01-2022
  sales_all  |              2 | Smirnoff         | New York       |          500 | 03-03-2022
  sales_all  |              4 | Ivanov           | Warsaw         |          750 | 03-04-2022
@@ -566,6 +562,10 @@ SELECT tableoid::regclass, * FROM sales_list ORDER BY tableoid, salesperson_id;
  sales_all  |             12 | Smith            | Kyiv           |          350 | 03-10-2022
  sales_all  |             13 | Gandi            | Warsaw         |          150 | 03-08-2022
  sales_all  |             14 | Plato            | Lisbon         |          950 | 03-05-2022
+ sales_nord |              3 | Ford             | St. Petersburg |         2000 | 03-05-2022
+ sales_nord |              7 | May              | Helsinki       |         1200 | 03-06-2022
+ sales_nord |              9 | May              | Helsinki       |         1200 | 03-11-2022
+ sales_nord |             10 | Halder           | Oslo           |          800 | 03-02-2022
 (14 rows)
 
 -- Use indexscan for testing indexes after merging partitions
@@ -651,7 +651,6 @@ CREATE TABLE tp_1_2 PARTITION OF t FOR VALUES FROM (1) TO (2);
 CREATE INDEX tidx ON t(i);
 ALTER TABLE t MERGE PARTITIONS (tp_1_2, tp_0_1) INTO tp_1_2;
 -- Indexname values should be 'tp_1_2_pkey' and 'tp_1_2_i_idx'.
--- Not-null constraint name should be 'tp_1_2_i_not_null'.
 \d+ tp_1_2
                           Table "partitions_merge_schema.tp_1_2"
  Column |  Type   | Collation | Nullable | Default | Storage | Stats target | Description 
@@ -807,66 +806,56 @@ CREATE TABLE t (i int) PARTITION BY RANGE (i);
 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);
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --error
 ERROR:  must be owner of table t
 RESET SESSION AUTHORIZATION;
 ALTER TABLE t OWNER TO regress_partition_merge_bob;
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --error
 ERROR:  must be owner of table tp_0_1
 RESET SESSION AUTHORIZATION;
 ALTER TABLE tp_0_1 OWNER TO regress_partition_merge_bob;
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --error
 ERROR:  must be owner of table tp_1_2
 RESET SESSION AUTHORIZATION;
 ALTER TABLE tp_1_2 OWNER TO regress_partition_merge_bob;
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --ok
 RESET SESSION AUTHORIZATION;
 DROP TABLE t;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_alice;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_bob;
-DROP ROLE regress_partition_merge_alice;
-DROP ROLE regress_partition_merge_bob;
 -- Test: we can't merge partitions with different owners
-CREATE ROLE regress_partitions_merge_alice;
-CREATE ROLE regress_partitions_merge_bob;
-GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partitions_merge_alice;
-GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partitions_merge_bob;
-SET SESSION AUTHORIZATION regress_partitions_merge_alice;
 CREATE TABLE tp_0_1(i int);
-RESET SESSION AUTHORIZATION;
-SET SESSION AUTHORIZATION regress_partitions_merge_bob;
+ALTER TABLE tp_0_1 OWNER TO regress_partition_merge_alice;
 CREATE TABLE tp_1_2(i int);
-RESET SESSION AUTHORIZATION;
+ALTER TABLE tp_1_2 OWNER TO regress_partition_merge_bob;
 CREATE TABLE t (i int) PARTITION BY RANGE (i);
 ALTER TABLE t ATTACH PARTITION tp_0_1 FOR VALUES FROM (0) TO (1);
 ALTER TABLE t ATTACH PARTITION tp_1_2 FOR VALUES FROM (1) TO (2);
--- Owner is 'regress_partitions_merge_alice':
+-- Owner is 'regress_partition_merge_alice':
 \dt tp_0_1
                               List of tables
-         Schema          |  Name  | Type  |             Owner              
--------------------------+--------+-------+--------------------------------
- partitions_merge_schema | tp_0_1 | table | regress_partitions_merge_alice
+         Schema          |  Name  | Type  |             Owner             
+-------------------------+--------+-------+-------------------------------
+ partitions_merge_schema | tp_0_1 | table | regress_partition_merge_alice
 (1 row)
 
--- Owner is 'regress_partitions_merge_bob':
+-- Owner is 'regress_partition_merge_bob':
 \dt tp_1_2
                              List of tables
-         Schema          |  Name  | Type  |            Owner             
--------------------------+--------+-------+------------------------------
- partitions_merge_schema | tp_1_2 | table | regress_partitions_merge_bob
+         Schema          |  Name  | Type  |            Owner            
+-------------------------+--------+-------+-----------------------------
+ partitions_merge_schema | tp_1_2 | table | regress_partition_merge_bob
 (1 row)
 
 -- ERROR:  partitions being merged have different owners
 ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
 ERROR:  partitions being merged have different owners
 DROP TABLE t;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partitions_merge_alice;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partitions_merge_bob;
-DROP ROLE regress_partitions_merge_alice;
-DROP ROLE regress_partitions_merge_bob;
+REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_alice;
+REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_bob;
+DROP ROLE regress_partition_merge_alice;
+DROP ROLE regress_partition_merge_bob;
 -- Test for hash partitioned table
 CREATE TABLE t (i int) PARTITION BY HASH(i);
 CREATE TABLE tp1 PARTITION OF t FOR VALUES WITH (MODULUS 2, REMAINDER 0);
@@ -885,6 +874,7 @@ DROP TABLE t;
 -- * STORAGE is the same as STORAGE for partitioned table
 -- * GENERATED and CONSTRAINTS are the same as GENERATED and CONSTRAINTS for partitioned table
 -- * TRIGGERS are the same as TRIGGERS for partitioned table
+\set HIDE_TOAST_COMPRESSION false
 CREATE TABLE t
 (i int NOT NULL,
  t text STORAGE EXTENDED COMPRESSION pglz DEFAULT 'default_t',
@@ -928,13 +918,13 @@ CREATE TRIGGER tp_0_1_before_insert_row_trigger BEFORE INSERT ON tp_0_1 FOR EACH
 CREATE TRIGGER tp_1_2_before_insert_row_trigger BEFORE INSERT ON tp_1_2 FOR EACH ROW
   EXECUTE PROCEDURE trigger_function('tp_1_2');
 \d+ tp_0_1
-                                              Table "partitions_merge_schema.tp_0_1"
- Column |  Type   | Collation | Nullable |                     Default                     | Storage | Stats target | Description 
---------+---------+-----------+----------+-------------------------------------------------+---------+--------------+-------------
- i      | integer |           | not null |                                                 | plain   |              | tp_0_1.i
- t      | text    |           |          | 'default_tp_0_1'::text                          | main    |              | 
- b      | bigint  |           | not null |                                                 | plain   |              | 
- d      | date    |           |          | generated always as ('02-02-2022'::date) stored | plain   |              | 
+                                                     Table "partitions_merge_schema.tp_0_1"
+ Column |  Type   | Collation | Nullable |                     Default                     | Storage | Compression | Stats target | Description 
+--------+---------+-----------+----------+-------------------------------------------------+---------+-------------+--------------+-------------
+ i      | integer |           | not null |                                                 | plain   |             |              | tp_0_1.i
+ t      | text    |           |          | 'default_tp_0_1'::text                          | main    |             |              | 
+ b      | bigint  |           | not null |                                                 | plain   |             |              | 
+ d      | date    |           |          | generated always as ('02-02-2022'::date) stored | plain   |             |              | 
 Partition of: t FOR VALUES FROM (0) TO (1)
 Partition constraint: ((abs(i) IS NOT NULL) AND (abs(i) >= 0) AND (abs(i) < 1))
 Check constraints:
@@ -952,13 +942,13 @@ Triggers:
 
 ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_1;
 \d+ tp_0_1
-                                              Table "partitions_merge_schema.tp_0_1"
- Column |  Type   | Collation | Nullable |                     Default                     | Storage  | Stats target | Description 
---------+---------+-----------+----------+-------------------------------------------------+----------+--------------+-------------
- i      | integer |           | not null |                                                 | plain    |              | 
- t      | text    |           |          | 'default_t'::text                               | extended |              | 
- b      | bigint  |           | not null |                                                 | plain    |              | 
- d      | date    |           |          | generated always as ('01-01-2022'::date) stored | plain    |              | 
+                                                     Table "partitions_merge_schema.tp_0_1"
+ Column |  Type   | Collation | Nullable |                     Default                     | Storage  | Compression | Stats target | Description 
+--------+---------+-----------+----------+-------------------------------------------------+----------+-------------+--------------+-------------
+ i      | integer |           | not null |                                                 | plain    |             |              | 
+ t      | text    |           |          | 'default_t'::text                               | extended | pglz        |              | 
+ b      | bigint  |           | not null |                                                 | plain    |             |              | 
+ d      | date    |           |          | generated always as ('01-01-2022'::date) stored | plain    |             |              | 
 Partition of: t FOR VALUES FROM (0) TO (2)
 Partition constraint: ((abs(i) IS NOT NULL) AND (abs(i) >= 0) AND (abs(i) < 2))
 Check constraints:
@@ -983,6 +973,7 @@ SELECT tableoid::regclass, * FROM t ORDER BY b;
 
 DROP TABLE t;
 DROP FUNCTION trigger_function();
+\set HIDE_TOAST_COMPRESSION true
 -- Test MERGE PARTITIONS with not valid foreign key constraint
 CREATE TABLE t (i INT PRIMARY KEY) PARTITION BY RANGE (i);
 CREATE TABLE tp_0_1 PARTITION OF t FOR VALUES FROM (0) TO (1);
diff --git a/src/test/regress/sql/partition_merge.sql b/src/test/regress/sql/partition_merge.sql
index cfb6083e12c..7275c8da1fa 100644
--- a/src/test/regress/sql/partition_merge.sql
+++ b/src/test/regress/sql/partition_merge.sql
@@ -111,7 +111,7 @@ EXECUTE get_partition_info('{sales_range}');
 
 SELECT * FROM pg_indexes WHERE tablename = 'sales_feb_mar_apr2022' and schemaname = 'partitions_merge_schema2';
 
-SELECT tableoid::regclass, * FROM sales_range ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_range ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
 
 -- Use indexscan for testing indexes
 SET enable_seqscan = OFF;
@@ -320,11 +320,11 @@ INSERT INTO sales_range VALUES
   (13, 'Gandi',    377,  '2022-01-09'),
   (14, 'Smith',    510,  '2022-05-04');
 
-SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
 
 ALTER TABLE sales_apr2022 MERGE PARTITIONS (sales_apr2022_01_10, sales_apr2022_10_20, sales_apr2022_20_30) INTO sales_apr_all;
 
-SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_apr2022 ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
 
 DROP TABLE sales_range;
 
@@ -413,7 +413,7 @@ ALTER TABLE sales_list MERGE PARTITIONS (sales_west, sales_east, sales_central)
 -- show partitions with conditions:
 EXECUTE get_partition_info('{sales_list}');
 
-SELECT tableoid::regclass, * FROM sales_list ORDER BY tableoid, salesperson_id;
+SELECT tableoid::regclass, * FROM sales_list ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id;
 
 -- Use indexscan for testing indexes after merging partitions
 SET enable_seqscan = OFF;
@@ -461,7 +461,6 @@ CREATE INDEX tidx ON t(i);
 ALTER TABLE t MERGE PARTITIONS (tp_1_2, tp_0_1) INTO tp_1_2;
 
 -- Indexname values should be 'tp_1_2_pkey' and 'tp_1_2_i_idx'.
--- Not-null constraint name should be 'tp_1_2_i_not_null'.
 \d+ tp_1_2
 
 DROP TABLE t;
@@ -568,61 +567,50 @@ 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);
 
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --error
 RESET SESSION AUTHORIZATION;
 
 ALTER TABLE t OWNER TO regress_partition_merge_bob;
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --error
 RESET SESSION AUTHORIZATION;
 
 ALTER TABLE tp_0_1 OWNER TO regress_partition_merge_bob;
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --error
 RESET SESSION AUTHORIZATION;
 
 ALTER TABLE tp_1_2 OWNER TO regress_partition_merge_bob;
 SET SESSION AUTHORIZATION regress_partition_merge_bob;
-ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
+ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2; --ok
 RESET SESSION AUTHORIZATION;
 
 DROP TABLE t;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_alice;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_bob;
-DROP ROLE regress_partition_merge_alice;
-DROP ROLE regress_partition_merge_bob;
-
 
 -- Test: we can't merge partitions with different owners
-CREATE ROLE regress_partitions_merge_alice;
-CREATE ROLE regress_partitions_merge_bob;
-GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partitions_merge_alice;
-GRANT ALL ON SCHEMA partitions_merge_schema TO regress_partitions_merge_bob;
-SET SESSION AUTHORIZATION regress_partitions_merge_alice;
 CREATE TABLE tp_0_1(i int);
-RESET SESSION AUTHORIZATION;
-SET SESSION AUTHORIZATION regress_partitions_merge_bob;
+ALTER TABLE tp_0_1 OWNER TO regress_partition_merge_alice;
 CREATE TABLE tp_1_2(i int);
-RESET SESSION AUTHORIZATION;
+ALTER TABLE tp_1_2 OWNER TO regress_partition_merge_bob;
 
 CREATE TABLE t (i int) PARTITION BY RANGE (i);
 
 ALTER TABLE t ATTACH PARTITION tp_0_1 FOR VALUES FROM (0) TO (1);
 ALTER TABLE t ATTACH PARTITION tp_1_2 FOR VALUES FROM (1) TO (2);
 
--- Owner is 'regress_partitions_merge_alice':
+-- Owner is 'regress_partition_merge_alice':
 \dt tp_0_1
--- Owner is 'regress_partitions_merge_bob':
+-- Owner is 'regress_partition_merge_bob':
 \dt tp_1_2
 
 -- ERROR:  partitions being merged have different owners
 ALTER TABLE t MERGE PARTITIONS (tp_0_1, tp_1_2) INTO tp_0_2;
 
 DROP TABLE t;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partitions_merge_alice;
-REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partitions_merge_bob;
-DROP ROLE regress_partitions_merge_alice;
-DROP ROLE regress_partitions_merge_bob;
+REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_alice;
+REVOKE ALL ON SCHEMA partitions_merge_schema FROM regress_partition_merge_bob;
+DROP ROLE regress_partition_merge_alice;
+DROP ROLE regress_partition_merge_bob;
 
 
 -- Test for hash partitioned table
@@ -646,6 +634,7 @@ DROP TABLE t;
 -- * STORAGE is the same as STORAGE for partitioned table
 -- * GENERATED and CONSTRAINTS are the same as GENERATED and CONSTRAINTS for partitioned table
 -- * TRIGGERS are the same as TRIGGERS for partitioned table
+\set HIDE_TOAST_COMPRESSION false
 
 CREATE TABLE t
 (i int NOT NULL,
@@ -704,6 +693,7 @@ INSERT INTO t(i, t, b) VALUES(1, DEFAULT, 3);
 SELECT tableoid::regclass, * FROM t ORDER BY b;
 DROP TABLE t;
 DROP FUNCTION trigger_function();
+\set HIDE_TOAST_COMPRESSION true
 
 
 -- Test MERGE PARTITIONS with not valid foreign key constraint
-- 
2.34.1