Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ff21c0

Browse files
committed
psql: Make output of \dD more stable
\dD showed domain check constraints in arbitrary order, which can cause regression test failures, which was exposed by commit 9895b35. To fix, order the constraints by conname, which matches what psql does in other queries listing constraints.
1 parent 9895b35 commit 6ff21c0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/bin/psql/describe.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4449,7 +4449,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem)
44494449
" CASE WHEN t.typnotnull THEN 'not null' END as \"%s\",\n"
44504450
" t.typdefault as \"%s\",\n"
44514451
" pg_catalog.array_to_string(ARRAY(\n"
4452-
" SELECT pg_catalog.pg_get_constraintdef(r.oid, true) FROM pg_catalog.pg_constraint r WHERE t.oid = r.contypid AND r.contype = 'c'\n"
4452+
" SELECT pg_catalog.pg_get_constraintdef(r.oid, true) FROM pg_catalog.pg_constraint r WHERE t.oid = r.contypid AND r.contype = 'c' ORDER BY r.conname\n"
44534453
" ), ' ') as \"%s\"",
44544454
gettext_noop("Schema"),
44554455
gettext_noop("Name"),

src/test/regress/expected/domain.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ alter domain con add check (VALUE > 0);
789789
List of domains
790790
Schema | Name | Type | Collation | Nullable | Default | Check
791791
--------+------+---------+-----------+----------+---------+--------------------------------------
792-
public | con | integer | | | | CHECK (VALUE < 34) CHECK (VALUE > 0)
792+
public | con | integer | | | | CHECK (VALUE > 0) CHECK (VALUE < 34)
793793
(1 row)
794794

795795
insert into domcontest values (-5); -- fails

0 commit comments

Comments
 (0)