From 7bff9f106a5ec36bd97829ca7eb97fc2a4705406 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Mon, 30 Mar 2026 11:06:42 +0900 Subject: [PATCH] psql: Make \d+ partition list formatting consistent with other objects Previously, \d+ displayed partitions differently from other object lists: the first partition appeared on the same line as the "Partitions" header. For example: Partitions: pt12 FOR VALUES IN (1, 2), pt34 FOR VALUES IN (3, 4) This commit updates the output so that partitions are listed consistently with other objects, with each entry on its own line starting below the header: Partitions: pt12 FOR VALUES IN (1, 2) pt34 FOR VALUES IN (3, 4) Author: Peter Smith Reviewed-by: Chao Li Reviewed-by: Neil Chen Reviewed-by: Greg Sabino Mullane Reviewed-by: Soumya S Murali Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/CAHut+Pu1puO00C-OhgLnAcECzww8MB3Q8DCsvx0cZWHRfs4gBQ@mail.gmail.com --- contrib/seg/expected/partition.out | 5 +- src/bin/psql/describe.c | 16 ++--- src/test/regress/expected/alter_table.out | 6 +- src/test/regress/expected/constraints.out | 22 ++++--- src/test/regress/expected/create_table.out | 17 +++-- src/test/regress/expected/foreign_data.out | 64 ++++++++++++------- src/test/regress/expected/inherit.out | 58 +++++++++++------ src/test/regress/expected/insert.out | 32 +++++----- src/test/regress/expected/partition_split.out | 23 ++++--- .../regress/expected/replica_identity.out | 6 +- src/test/regress/expected/rowsecurity.out | 7 +- src/test/regress/expected/tablespace.out | 10 +-- 12 files changed, 160 insertions(+), 106 deletions(-) diff --git a/contrib/seg/expected/partition.out b/contrib/seg/expected/partition.out index 90d8397d5d4..8b86a406993 100644 --- a/contrib/seg/expected/partition.out +++ b/contrib/seg/expected/partition.out @@ -35,8 +35,9 @@ Indexes: "pti1" btree ((mydouble(category) + 1)) "pti2" btree (sdata) "pti3" btree (tdata COLLATE mycollation) -Partitions: pt12 FOR VALUES IN (1, 2), - pt34 FOR VALUES IN (3, 4) +Partitions: + pt12 FOR VALUES IN (1, 2) + pt34 FOR VALUES IN (3, 4) \d+ pt12 Table "public.pt12" diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 7d1231c0558..44e6cb6d7ac 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -3760,18 +3760,18 @@ describeOneTableDetails(const char *schemaname, { /* display the list of child tables */ const char *ct = is_partitioned ? _("Partitions") : _("Child tables"); - int ctw = pg_wcswidth(ct, strlen(ct), pset.encoding); + + if (tuples > 0) + { + printfPQExpBuffer(&buf, "%s:", ct); + printTableAddFooter(&cont, buf.data); + } for (i = 0; i < tuples; i++) { char child_relkind = *PQgetvalue(result, i, 1); - if (i == 0) - printfPQExpBuffer(&buf, "%s: %s", - ct, PQgetvalue(result, i, 0)); - else - printfPQExpBuffer(&buf, "%*s %s", - ctw, "", PQgetvalue(result, i, 0)); + printfPQExpBuffer(&buf, " %s", PQgetvalue(result, i, 0)); if (!PQgetisnull(result, i, 3)) appendPQExpBuffer(&buf, " %s", PQgetvalue(result, i, 3)); if (child_relkind == RELKIND_PARTITIONED_TABLE || @@ -3781,8 +3781,6 @@ describeOneTableDetails(const char *schemaname, appendPQExpBufferStr(&buf, ", FOREIGN"); if (strcmp(PQgetvalue(result, i, 2), "t") == 0) appendPQExpBufferStr(&buf, " (DETACH PENDING)"); - if (i < tuples - 1) - appendPQExpBufferChar(&buf, ','); printTableAddFooter(&cont, buf.data); } diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out index ccd79dfecc0..9872899586a 100644 --- a/src/test/regress/expected/alter_table.out +++ b/src/test/regress/expected/alter_table.out @@ -1236,7 +1236,8 @@ primary key, btree, for table "public.atnnpart1" Partition key: LIST (id) Not-null constraints: "dummy_constr" NOT NULL "id" NOT VALID -Partitions: atnnpart1 FOR VALUES IN (1) +Partitions: + atnnpart1 FOR VALUES IN (1) BEGIN; ALTER TABLE atnnparted VALIDATE CONSTRAINT dummy_constr; @@ -1267,7 +1268,8 @@ primary key, btree, for table "public.atnnpart1" Partition key: LIST (id) Not-null constraints: "dummy_constr" NOT NULL "id" -Partitions: atnnpart1 FOR VALUES IN (1) +Partitions: + atnnpart1 FOR VALUES IN (1) ROLLBACK; -- leave a table in this state for the pg_upgrade test diff --git a/src/test/regress/expected/constraints.out b/src/test/regress/expected/constraints.out index 0ed817f0c2c..75f61377143 100644 --- a/src/test/regress/expected/constraints.out +++ b/src/test/regress/expected/constraints.out @@ -1195,7 +1195,8 @@ Indexes: "cnn_primarykey" PRIMARY KEY, btree (b) Not-null constraints: "cnn_pk_b_not_null" NOT NULL "b" -Child tables: cnn_pk_child +Child tables: + cnn_pk_child Table "public.cnn_pk_child" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description @@ -1215,7 +1216,8 @@ ALTER TABLE cnn_pk DROP CONSTRAINT cnn_primarykey; b | integer | | not null | | plain | | Not-null constraints: "cnn_pk_b_not_null" NOT NULL "b" -Child tables: cnn_pk_child +Child tables: + cnn_pk_child Table "public.cnn_pk_child" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description @@ -1240,7 +1242,8 @@ Indexes: "cnn_primarykey" PRIMARY KEY, btree (b) Not-null constraints: "cnn_pk_b_not_null" NOT NULL "b" -Child tables: cnn_pk_child +Child tables: + cnn_pk_child Table "public.cnn_pk_child" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description @@ -1260,7 +1263,8 @@ ALTER TABLE cnn_pk DROP CONSTRAINT cnn_primarykey; b | integer | | not null | | plain | | Not-null constraints: "cnn_pk_b_not_null" NOT NULL "b" -Child tables: cnn_pk_child +Child tables: + cnn_pk_child Table "public.cnn_pk_child" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description @@ -1288,7 +1292,8 @@ Indexes: "cnn_primarykey" PRIMARY KEY, btree (b) Not-null constraints: "cnn_pk_b_not_null" NOT NULL "b" -Child tables: cnn_pk_child +Child tables: + cnn_pk_child Table "public.cnn_pk_child" Column | Type | Collation | Nullable | Default | Storage | Stats target | Description @@ -1356,9 +1361,10 @@ Indexes: "notnull_tbl4_pkey" PRIMARY KEY, btree (a) DEFERRABLE INITIALLY DEFERRED Not-null constraints: "notnull_tbl4_a_not_null" NOT NULL "a" -Child tables: notnull_tbl4_cld, - notnull_tbl4_cld2, - notnull_tbl4_cld3 +Child tables: + notnull_tbl4_cld + notnull_tbl4_cld2 + notnull_tbl4_cld3 \d+ notnull_tbl4_lk Table "public.notnull_tbl4_lk" diff --git a/src/test/regress/expected/create_table.out b/src/test/regress/expected/create_table.out index 90639ea0d89..a7a24fa3adc 100644 --- a/src/test/regress/expected/create_table.out +++ b/src/test/regress/expected/create_table.out @@ -431,10 +431,11 @@ CREATE TABLE part_null PARTITION OF list_parted FOR VALUES IN (null); --------+---------+-----------+----------+---------+---------+--------------+------------- a | integer | | | | plain | | Partition key: LIST (a) -Partitions: part_null FOR VALUES IN (NULL), - part_p1 FOR VALUES IN (1), - part_p2 FOR VALUES IN (2), - part_p3 FOR VALUES IN (3) +Partitions: + part_null FOR VALUES IN (NULL) + part_p1 FOR VALUES IN (1) + part_p2 FOR VALUES IN (2) + part_p3 FOR VALUES IN (3) -- forbidden expressions for partition bound with list partitioned table CREATE TABLE part_bogus_expr_fail PARTITION OF list_parted FOR VALUES IN (somename); @@ -899,7 +900,8 @@ Partition constraint: ((a IS NOT NULL) AND (a = 'c'::text)) Partition key: RANGE (b) Not-null constraints: "part_c_b_not_null" NOT NULL "b" (local, inherited) -Partitions: part_c_1_10 FOR VALUES FROM (1) TO (10) +Partitions: + part_c_1_10 FOR VALUES FROM (1) TO (10) -- a level-2 partition's constraint will include the parent's expressions \d+ part_c_1_10 @@ -1044,8 +1046,9 @@ create table boolspart_f partition of boolspart for values in (false); --------+---------+-----------+----------+---------+---------+--------------+------------- a | boolean | | | | plain | | Partition key: LIST (a) -Partitions: boolspart_f FOR VALUES IN (false), - boolspart_t FOR VALUES IN (true) +Partitions: + boolspart_f FOR VALUES IN (false) + boolspart_t FOR VALUES IN (true) drop table boolspart; -- partitions mixing temporary and permanent relations diff --git a/src/test/regress/expected/foreign_data.out b/src/test/regress/expected/foreign_data.out index 305a9f9e54e..8bf84f28df0 100644 --- a/src/test/regress/expected/foreign_data.out +++ b/src/test/regress/expected/foreign_data.out @@ -1445,7 +1445,8 @@ CREATE FOREIGN TABLE ft2 () INHERITS (fd_pt1) c3 | date | | | | plain | | Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1498,7 +1499,8 @@ ALTER FOREIGN TABLE ft2 INHERIT fd_pt1; c3 | date | | | | plain | | Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1535,8 +1537,9 @@ Not-null constraints: Server: s0 FDW options: (delimiter ',', quote '"', "be quoted" 'value') Inherits: fd_pt1 -Child tables: ct3, - ft3, FOREIGN +Child tables: + ct3 + ft3, FOREIGN \d+ ct3 Table "public.ct3" @@ -1582,7 +1585,8 @@ ALTER TABLE fd_pt1 ADD COLUMN c8 integer; Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" "fd_pt1_c7_not_null" NOT NULL "c7" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1602,8 +1606,9 @@ Not-null constraints: Server: s0 FDW options: (delimiter ',', quote '"', "be quoted" 'value') Inherits: fd_pt1 -Child tables: ct3, - ft3, FOREIGN +Child tables: + ct3 + ft3, FOREIGN \d+ ct3 Table "public.ct3" @@ -1668,7 +1673,8 @@ ALTER TABLE fd_pt1 ALTER COLUMN c8 SET STORAGE EXTERNAL; Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" "fd_pt1_c6_not_null" NOT NULL "c6" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1688,8 +1694,9 @@ Not-null constraints: Server: s0 FDW options: (delimiter ',', quote '"', "be quoted" 'value') Inherits: fd_pt1 -Child tables: ct3, - ft3, FOREIGN +Child tables: + ct3 + ft3, FOREIGN -- drop attributes recursively ALTER TABLE fd_pt1 DROP COLUMN c4; @@ -1706,7 +1713,8 @@ ALTER TABLE fd_pt1 DROP COLUMN c8; c3 | date | | | | plain | | Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1720,8 +1728,9 @@ Not-null constraints: Server: s0 FDW options: (delimiter ',', quote '"', "be quoted" 'value') Inherits: fd_pt1 -Child tables: ct3, - ft3, FOREIGN +Child tables: + ct3 + ft3, FOREIGN -- add constraints recursively ALTER TABLE fd_pt1 ADD CONSTRAINT fd_pt1chk1 CHECK (c1 > 0) NO INHERIT; @@ -1751,7 +1760,8 @@ Check constraints: "fd_pt1chk2" CHECK (c2 <> ''::text) Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1767,8 +1777,9 @@ Not-null constraints: Server: s0 FDW options: (delimiter ',', quote '"', "be quoted" 'value') Inherits: fd_pt1 -Child tables: ct3, - ft3, FOREIGN +Child tables: + ct3 + ft3, FOREIGN DROP FOREIGN TABLE ft2; -- ERROR ERROR: cannot drop foreign table ft2 because other objects depend on it @@ -1802,7 +1813,8 @@ Check constraints: "fd_pt1chk2" CHECK (c2 <> ''::text) Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1836,7 +1848,8 @@ Check constraints: "fd_pt1chk3" CHECK (c2 <> ''::text) NOT VALID Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1867,7 +1880,8 @@ Check constraints: "fd_pt1chk3" CHECK (c2 <> ''::text) Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "c1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1902,7 +1916,8 @@ Check constraints: "f2_check" CHECK (f2 <> ''::text) Not-null constraints: "fd_pt1_c1_not_null" NOT NULL "f1" -Child tables: ft2, FOREIGN +Child tables: + ft2, FOREIGN \d+ ft2 Foreign table "public.ft2" @@ -1964,7 +1979,8 @@ CREATE FOREIGN TABLE fd_pt2_1 PARTITION OF fd_pt2 FOR VALUES IN (1) Partition key: LIST (c1) Not-null constraints: "fd_pt2_c1_not_null" NOT NULL "c1" -Partitions: fd_pt2_1 FOR VALUES IN (1), FOREIGN +Partitions: + fd_pt2_1 FOR VALUES IN (1), FOREIGN \d+ fd_pt2_1 Foreign table "public.fd_pt2_1" @@ -2046,7 +2062,8 @@ ALTER TABLE fd_pt2 ATTACH PARTITION fd_pt2_1 FOR VALUES IN (1); Partition key: LIST (c1) Not-null constraints: "fd_pt2_c1_not_null" NOT NULL "c1" -Partitions: fd_pt2_1 FOR VALUES IN (1), FOREIGN +Partitions: + fd_pt2_1 FOR VALUES IN (1), FOREIGN \d+ fd_pt2_1 Foreign table "public.fd_pt2_1" @@ -2078,7 +2095,8 @@ ALTER TABLE fd_pt2_1 ADD CONSTRAINT p21chk CHECK (c2 <> ''); Partition key: LIST (c1) Not-null constraints: "fd_pt2_c1_not_null" NOT NULL "c1" -Partitions: fd_pt2_1 FOR VALUES IN (1), FOREIGN +Partitions: + fd_pt2_1 FOR VALUES IN (1), FOREIGN \d+ fd_pt2_1 Foreign table "public.fd_pt2_1" diff --git a/src/test/regress/expected/inherit.out b/src/test/regress/expected/inherit.out index 36f81f39265..7b646836ec9 100644 --- a/src/test/regress/expected/inherit.out +++ b/src/test/regress/expected/inherit.out @@ -1110,8 +1110,9 @@ NOTICE: merging definition of column "j" for child "inhtd" --------+---------+-----------+----------+---------+---------+--------------+------------- i | integer | | | | plain | | j | bigint | | | 1 | plain | | -Child tables: inhtb, - inhtd +Child tables: + inhtb + inhtd \d+ inhtd Table "public.inhtd" @@ -1204,7 +1205,8 @@ CREATE TABLE test_constraints_inh () INHERITS (test_constraints); val2 | integer | | | | plain | | Indexes: "test_constraints_val1_val2_key" UNIQUE CONSTRAINT, btree (val1, val2) -Child tables: test_constraints_inh +Child tables: + test_constraints_inh ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key; \d+ test_constraints @@ -1214,7 +1216,8 @@ ALTER TABLE ONLY test_constraints DROP CONSTRAINT test_constraints_val1_val2_key id | integer | | | | plain | | val1 | character varying | | | | extended | | val2 | integer | | | | plain | | -Child tables: test_constraints_inh +Child tables: + test_constraints_inh \d+ test_constraints_inh Table "public.test_constraints_inh" @@ -1239,7 +1242,8 @@ CREATE TABLE test_ex_constraints_inh () INHERITS (test_ex_constraints); c | circle | | | | plain | | Indexes: "test_ex_constraints_c_excl" EXCLUDE USING gist (c WITH &&) -Child tables: test_ex_constraints_inh +Child tables: + test_ex_constraints_inh ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl; \d+ test_ex_constraints @@ -1247,7 +1251,8 @@ ALTER TABLE test_ex_constraints DROP CONSTRAINT test_ex_constraints_c_excl; Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+--------+-----------+----------+---------+---------+--------------+------------- c | circle | | | | plain | | -Child tables: test_ex_constraints_inh +Child tables: + test_ex_constraints_inh \d+ test_ex_constraints_inh Table "public.test_ex_constraints_inh" @@ -1281,7 +1286,8 @@ Not-null constraints: id1 | integer | | | | plain | | Foreign-key constraints: "test_foreign_constraints_id1_fkey" FOREIGN KEY (id1) REFERENCES test_primary_constraints(id) -Child tables: test_foreign_constraints_inh +Child tables: + test_foreign_constraints_inh ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id1_fkey; \d+ test_foreign_constraints @@ -1289,7 +1295,8 @@ ALTER TABLE test_foreign_constraints DROP CONSTRAINT test_foreign_constraints_id Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------+--------------+------------- id1 | integer | | | | plain | | -Child tables: test_foreign_constraints_inh +Child tables: + test_foreign_constraints_inh \d+ test_foreign_constraints_inh Table "public.test_foreign_constraints_inh" @@ -2290,7 +2297,8 @@ Not-null constraints: "pp1_f1_not_null" NOT NULL "f1" (inherited) "nn" NOT NULL "a2" Inherits: pp1 -Child tables: cc2 +Child tables: + cc2 \d+ cc2 Table "public.cc2" @@ -2315,8 +2323,9 @@ alter table pp1 alter column f1 set not null; f1 | integer | | not null | | plain | | Not-null constraints: "pp1_f1_not_null" NOT NULL "f1" -Child tables: cc1, - cc2 +Child tables: + cc1 + cc2 \d+ cc1 Table "public.cc1" @@ -2330,7 +2339,8 @@ Not-null constraints: "pp1_f1_not_null" NOT NULL "f1" (inherited) "nn" NOT NULL "a2" Inherits: pp1 -Child tables: cc2 +Child tables: + cc2 \d+ cc2 Table "public.cc2" @@ -2373,7 +2383,8 @@ alter table cc1 alter column a2 drop not null; Not-null constraints: "pp1_f1_not_null" NOT NULL "f1" (inherited) Inherits: pp1 -Child tables: cc2 +Child tables: + cc2 -- same for cc2 alter table cc2 alter column f1 drop not null; @@ -2402,8 +2413,9 @@ alter table pp1 alter column f1 drop not null; Column | Type | Collation | Nullable | Default | Storage | Stats target | Description --------+---------+-----------+----------+---------+---------+--------------+------------- f1 | integer | | | | plain | | -Child tables: cc1, - cc2 +Child tables: + cc1 + cc2 alter table pp1 add primary key (f1); -- Leave these tables around, for pg_upgrade testing @@ -2572,8 +2584,9 @@ Inherits: inh_nn_parent a | integer | | not null | | plain | | Not-null constraints: "inh_nn_parent_a_not_null" NOT NULL "a" NO INHERIT -Child tables: inh_nn_child, - inh_nn_child2 +Child tables: + inh_nn_child + inh_nn_child2 drop table inh_nn_parent, inh_nn_child, inh_nn_child2; CREATE TABLE inh_nn_parent (a int, NOT NULL a NO INHERIT); @@ -2632,7 +2645,8 @@ alter table inh_parent alter column f1 set not null; f1 | integer | | not null | | plain | | Not-null constraints: "inh_parent_f1_not_null" NOT NULL "f1" -Child tables: inh_child1 +Child tables: + inh_child1 \d+ inh_child1 Table "public.inh_child1" @@ -2642,7 +2656,8 @@ Child tables: inh_child1 Not-null constraints: "inh_child1_f1_not_null" NOT NULL "f1" (local, inherited) Inherits: inh_parent -Child tables: inh_child2 +Child tables: + inh_child2 \d+ inh_child2 Table "public.inh_child2" @@ -2685,8 +2700,9 @@ Not-null constraints: f1 | integer | | not null | | plain | | Not-null constraints: "inh_child1_f1_not_null" NOT NULL "f1" -Child tables: inh_child2, - inh_child3 +Child tables: + inh_child2 + inh_child3 \d+ inh_child2 Table "public.inh_child2" diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out index cf4b5221a8d..75b8de79fce 100644 --- a/src/test/regress/expected/insert.out +++ b/src/test/regress/expected/insert.out @@ -567,13 +567,14 @@ from hash_parted order by part; a | text | | | | extended | | b | integer | | | | plain | | Partition key: LIST (lower(a)) -Partitions: part_aa_bb FOR VALUES IN ('aa', 'bb'), - part_cc_dd FOR VALUES IN ('cc', 'dd'), - part_ee_ff FOR VALUES IN ('ee', 'ff'), PARTITIONED, - part_gg FOR VALUES IN ('gg'), PARTITIONED, - part_null FOR VALUES IN (NULL), - part_xx_yy FOR VALUES IN ('xx', 'yy'), PARTITIONED, - part_default DEFAULT, PARTITIONED +Partitions: + part_aa_bb FOR VALUES IN ('aa', 'bb') + part_cc_dd FOR VALUES IN ('cc', 'dd') + part_ee_ff FOR VALUES IN ('ee', 'ff'), PARTITIONED + part_gg FOR VALUES IN ('gg'), PARTITIONED + part_null FOR VALUES IN (NULL) + part_xx_yy FOR VALUES IN ('xx', 'yy'), PARTITIONED + part_default DEFAULT, PARTITIONED -- cleanup drop table range_parted, list_parted; @@ -972,14 +973,15 @@ create table mcrparted8_ge_d partition of mcrparted for values from ('d', minval a | text | | | | extended | | b | integer | | | | plain | | Partition key: RANGE (a, b) -Partitions: mcrparted1_lt_b FOR VALUES FROM (MINVALUE, MINVALUE) TO ('b', MINVALUE), - mcrparted2_b FOR VALUES FROM ('b', MINVALUE) TO ('c', MINVALUE), - mcrparted3_c_to_common FOR VALUES FROM ('c', MINVALUE) TO ('common', MINVALUE), - mcrparted4_common_lt_0 FOR VALUES FROM ('common', MINVALUE) TO ('common', 0), - mcrparted5_common_0_to_10 FOR VALUES FROM ('common', 0) TO ('common', 10), - mcrparted6_common_ge_10 FOR VALUES FROM ('common', 10) TO ('common', MAXVALUE), - mcrparted7_gt_common_lt_d FOR VALUES FROM ('common', MAXVALUE) TO ('d', MINVALUE), - mcrparted8_ge_d FOR VALUES FROM ('d', MINVALUE) TO (MAXVALUE, MAXVALUE) +Partitions: + mcrparted1_lt_b FOR VALUES FROM (MINVALUE, MINVALUE) TO ('b', MINVALUE) + mcrparted2_b FOR VALUES FROM ('b', MINVALUE) TO ('c', MINVALUE) + mcrparted3_c_to_common FOR VALUES FROM ('c', MINVALUE) TO ('common', MINVALUE) + mcrparted4_common_lt_0 FOR VALUES FROM ('common', MINVALUE) TO ('common', 0) + mcrparted5_common_0_to_10 FOR VALUES FROM ('common', 0) TO ('common', 10) + mcrparted6_common_ge_10 FOR VALUES FROM ('common', 10) TO ('common', MAXVALUE) + mcrparted7_gt_common_lt_d FOR VALUES FROM ('common', MAXVALUE) TO ('d', MINVALUE) + mcrparted8_ge_d FOR VALUES FROM ('d', MINVALUE) TO (MAXVALUE, MAXVALUE) \d+ mcrparted1_lt_b Table "public.mcrparted1_lt_b" diff --git a/src/test/regress/expected/partition_split.out b/src/test/regress/expected/partition_split.out index 4004efe0dac..13ca733f9fa 100644 --- a/src/test/regress/expected/partition_split.out +++ b/src/test/regress/expected/partition_split.out @@ -138,10 +138,11 @@ SET search_path = partition_split_schema, public; salesperson_id | integer | | | | plain | | sales_date | date | | | | plain | | Partition key: RANGE (sales_date) -Partitions: partition_split_schema2.sales_apr2022 FOR VALUES FROM ('04-01-2022') TO ('05-01-2022'), - partition_split_schema2.sales_feb2022 FOR VALUES FROM ('02-01-2022') TO ('03-01-2022'), - partition_split_schema2.sales_mar2022 FOR VALUES FROM ('03-01-2022') TO ('04-01-2022'), - sales_jan2022 FOR VALUES FROM ('01-01-2022') TO ('02-01-2022') +Partitions: + partition_split_schema2.sales_apr2022 FOR VALUES FROM ('04-01-2022') TO ('05-01-2022') + partition_split_schema2.sales_feb2022 FOR VALUES FROM ('02-01-2022') TO ('03-01-2022') + partition_split_schema2.sales_mar2022 FOR VALUES FROM ('03-01-2022') TO ('04-01-2022') + sales_jan2022 FOR VALUES FROM ('01-01-2022') TO ('02-01-2022') DROP TABLE sales_range; DROP TABLE sales_others; @@ -242,11 +243,12 @@ ALTER TABLE sales_range SPLIT PARTITION sales_feb_mar_apr2022 INTO sales_amount | integer | | | | plain | | sales_date | date | | | | plain | | Partition key: RANGE (sales_date) -Partitions: partition_split_schema2.sales_mar2022 FOR VALUES FROM ('03-01-2022') TO ('04-01-2022'), - sales_apr2022 FOR VALUES FROM ('04-01-2022') TO ('05-01-2022'), - sales_feb2022 FOR VALUES FROM ('02-01-2022') TO ('03-01-2022'), - sales_jan2022 FOR VALUES FROM ('01-01-2022') TO ('02-01-2022'), - sales_others DEFAULT +Partitions: + partition_split_schema2.sales_mar2022 FOR VALUES FROM ('03-01-2022') TO ('04-01-2022') + sales_apr2022 FOR VALUES FROM ('04-01-2022') TO ('05-01-2022') + sales_feb2022 FOR VALUES FROM ('02-01-2022') TO ('03-01-2022') + sales_jan2022 FOR VALUES FROM ('01-01-2022') TO ('02-01-2022') + sales_others DEFAULT SELECT tableoid::regclass, * FROM sales_range ORDER BY tableoid::regclass::text COLLATE "C", salesperson_id; tableoid | salesperson_id | salesperson_name | sales_amount | sales_date @@ -1317,7 +1319,8 @@ CREATE TABLE t_bigint_default PARTITION OF t_bigint DEFAULT; j | integer | | | 101 | plain | | k | integer | | | generated always as ((b + 10)) stored | plain | | Partition key: RANGE (b) -Partitions: t_bigint_default DEFAULT +Partitions: + t_bigint_default DEFAULT \d+ t_bigint_default Table "partition_split_schema.t_bigint_default" diff --git a/src/test/regress/expected/replica_identity.out b/src/test/regress/expected/replica_identity.out index b9b8dde018f..336b04fa278 100644 --- a/src/test/regress/expected/replica_identity.out +++ b/src/test/regress/expected/replica_identity.out @@ -262,7 +262,8 @@ Indexes: "test_replica_identity4_pkey" PRIMARY KEY, btree (id) INVALID REPLICA IDENTITY Not-null constraints: "test_replica_identity4_id_not_null" NOT NULL "id" -Partitions: test_replica_identity4_1 FOR VALUES IN (1) +Partitions: + test_replica_identity4_1 FOR VALUES IN (1) ALTER INDEX test_replica_identity4_pkey ATTACH PARTITION test_replica_identity4_1_pkey; @@ -276,7 +277,8 @@ Indexes: "test_replica_identity4_pkey" PRIMARY KEY, btree (id) REPLICA IDENTITY Not-null constraints: "test_replica_identity4_id_not_null" NOT NULL "id" -Partitions: test_replica_identity4_1 FOR VALUES IN (1) +Partitions: + test_replica_identity4_1 FOR VALUES IN (1) -- Dropping the primary key is not allowed if that would leave the replica -- identity as nullable diff --git a/src/test/regress/expected/rowsecurity.out b/src/test/regress/expected/rowsecurity.out index 07d93e7def1..3a5e82c35bd 100644 --- a/src/test/regress/expected/rowsecurity.out +++ b/src/test/regress/expected/rowsecurity.out @@ -1261,9 +1261,10 @@ Policies: USING ((cid < 55)) Not-null constraints: "part_document_dlevel_not_null" NOT NULL "dlevel" -Partitions: part_document_fiction FOR VALUES FROM (11) TO (12), - part_document_nonfiction FOR VALUES FROM (99) TO (100), - part_document_satire FOR VALUES FROM (55) TO (56) +Partitions: + part_document_fiction FOR VALUES FROM (11) TO (12) + part_document_nonfiction FOR VALUES FROM (99) TO (100) + part_document_satire FOR VALUES FROM (55) TO (56) SELECT * FROM pg_policies WHERE schemaname = 'regress_rls_schema' AND tablename like '%part_document%' ORDER BY policyname; schemaname | tablename | policyname | permissive | roles | cmd | qual | with_check diff --git a/src/test/regress/expected/tablespace.out b/src/test/regress/expected/tablespace.out index 185880a3217..f0dd25cdf0c 100644 --- a/src/test/regress/expected/tablespace.out +++ b/src/test/regress/expected/tablespace.out @@ -355,8 +355,9 @@ Number of partitions: 2 (Use \d+ to list them.) Partition key: LIST (a) Indexes: "part_a_idx" btree (a), tablespace "regress_tblspace" -Partitions: testschema.part1 FOR VALUES IN (1), - testschema.part2 FOR VALUES IN (2) +Partitions: + testschema.part1 FOR VALUES IN (1) + testschema.part2 FOR VALUES IN (2) \d testschema.part1 Table "testschema.part1" @@ -392,8 +393,9 @@ Tablespace: "regress_tblspace" --------+---------+------+------------+---------+-------------- a | integer | yes | a | plain | btree, for table "testschema.part" -Partitions: testschema.part1_a_idx, - testschema.part2_a_idx +Partitions: + testschema.part1_a_idx + testschema.part2_a_idx Tablespace: "regress_tblspace" -- partitioned rels cannot specify the default tablespace. These fail: