From 7de7876cd547b7994b1b0c4bd831364679768029 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 23 Feb 2009 15:59:55 +0000 Subject: [PATCH] Fix psql's \dD to show only one row per domain, even when the domain has multiple check constraints. --- src/bin/psql/describe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index ec5760c531..beab9ca528 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -8,7 +8,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.199 2009/02/11 19:12:04 alvherre Exp $ + * $PostgreSQL: pgsql/src/bin/psql/describe.c,v 1.200 2009/02/23 15:59:55 tgl Exp $ */ #include "postgres_fe.h" @@ -2077,10 +2077,11 @@ listDomains(const char *pattern, bool showSystem) " WHEN NOT t.typnotnull AND t.typdefault IS NOT NULL THEN 'default '||t.typdefault\n" " ELSE ''\n" " END as \"%s\",\n" - " pg_catalog.pg_get_constraintdef(r.oid, true) 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\n" + " ), ' ') as \"%s\"\n" "FROM pg_catalog.pg_type t\n" " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n" - " LEFT JOIN pg_catalog.pg_constraint r ON t.oid = r.contypid\n" "WHERE t.typtype = 'd'\n", gettext_noop("Schema"), gettext_noop("Name"), @@ -2089,7 +2090,7 @@ listDomains(const char *pattern, bool showSystem) gettext_noop("Check")); if (!showSystem) - appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); + appendPQExpBuffer(&buf, " AND n.nspname <> 'pg_catalog'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "t.typname", NULL, -- 2.40.0