From 6ff21c05302592874b8149421711e06043b954fe Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 15 Apr 2024 09:28:48 +0200 Subject: [PATCH] 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 9895b35cb8. To fix, order the constraints by conname, which matches what psql does in other queries listing constraints. --- src/bin/psql/describe.c | 2 +- src/test/regress/expected/domain.out | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 1f0a056d90b..4a9ee4a54d5 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -4449,7 +4449,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem) " CASE WHEN t.typnotnull THEN 'not null' END as \"%s\",\n" " t.typdefault as \"%s\",\n" " pg_catalog.array_to_string(ARRAY(\n" - " 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" + " 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" " ), ' ') as \"%s\"", gettext_noop("Schema"), gettext_noop("Name"), diff --git a/src/test/regress/expected/domain.out b/src/test/regress/expected/domain.out index db0b8a180a3..f65b66345ab 100644 --- a/src/test/regress/expected/domain.out +++ b/src/test/regress/expected/domain.out @@ -789,7 +789,7 @@ alter domain con add check (VALUE > 0); List of domains Schema | Name | Type | Collation | Nullable | Default | Check --------+------+---------+-----------+----------+---------+-------------------------------------- - public | con | integer | | | | CHECK (VALUE < 34) CHECK (VALUE > 0) + public | con | integer | | | | CHECK (VALUE > 0) CHECK (VALUE < 34) (1 row) insert into domcontest values (-5); -- fails