Skip to content

Commit 3bae43c

Browse files
Sort default partition to bottom of psql \d+
Minor patch to change sort order only Author: Ashutosh Bapat Reviewed-by: Álvaro Herrera, Simon Riggs
1 parent 05b6ec3 commit 3bae43c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/bin/psql/describe.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2875,7 +2875,8 @@ describeOneTableDetails(const char *schemaname,
28752875
" c.relkind"
28762876
" FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i"
28772877
" WHERE c.oid=i.inhrelid AND i.inhparent = '%s'"
2878-
" ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;", oid);
2878+
" ORDER BY pg_catalog.pg_get_expr(c.relpartbound, c.oid) = 'DEFAULT',"
2879+
" c.oid::pg_catalog.regclass::pg_catalog.text;", oid);
28792880
else if (pset.sversion >= 80300)
28802881
printfPQExpBuffer(&buf,
28812882
"SELECT c.oid::pg_catalog.regclass"

src/test/regress/expected/insert.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,11 @@ from hash_parted order by part;
436436
Partition key: LIST (lower(a))
437437
Partitions: part_aa_bb FOR VALUES IN ('aa', 'bb'),
438438
part_cc_dd FOR VALUES IN ('cc', 'dd'),
439-
part_default DEFAULT, PARTITIONED,
440439
part_ee_ff FOR VALUES IN ('ee', 'ff'), PARTITIONED,
441440
part_gg FOR VALUES IN ('gg'), PARTITIONED,
442441
part_null FOR VALUES IN (NULL),
443-
part_xx_yy FOR VALUES IN ('xx', 'yy'), PARTITIONED
442+
part_xx_yy FOR VALUES IN ('xx', 'yy'), PARTITIONED,
443+
part_default DEFAULT, PARTITIONED
444444

445445
-- cleanup
446446
drop table range_parted, list_parted;

0 commit comments

Comments
 (0)