BUG #4670: Cannot get domain constraint names from psql

Поиск
Список
Период
Сортировка
От Alexander V. Chernikov
Тема BUG #4670: Cannot get domain constraint names from psql
Дата
Msg-id 200902220155.n1M1tUgQ040826@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #4670: Cannot get domain constraint names from psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      4670
Logged by:          Alexander V. Chernikov
Email address:      melifaro@ipfw.ru
PostgreSQL version: 8.3.3
Operating system:   FreeBSD 7.1
Description:        Cannot get domain constraint names from psql
Details:

It would be nice to see domain constraint names in \dD output of psql
utility. Without this feature the only way to delete (or modify) constraint
is to do pg_dump -s (or use something like phpgadmin) to find out constraint
name and only after that issue ALTER DOMAIN .. DROP constraint statement.
Patch for adding this functionality is quite trivial, for example:

--- bin/psql/describe.c.orig    2009-02-22 02:58:23.000000000 +0300
+++ bin/psql/describe.c 2009-02-22 03:05:54.000000000 +0300
@@ -1628,6 +1628,7 @@
                                          "            WHEN NOT t.typnotnull
AND t.typdefault IS NOT NULL THEN 'default '||t.typdefault\n"
                                          "            ELSE ''\n"
                                          "       END as \"%s\",\n"
+                                         "       r.conname as \"%s\",\n"
                        "       pg_catalog.pg_get_constraintdef(r.oid, true)
as \"%s\"\n"
                                          "FROM pg_catalog.pg_type t\n"
           "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid =
t.typnamespace\n"
@@ -1637,6 +1638,7 @@
                                          _("Name"),
                                          _("Type"),
                                          _("Modifier"),
+                                         _("Constraint_name"),
                                          _("Check"));

        processSQLNamePattern(pset.db, &buf, pattern, true, false,

В списке pgsql-bugs по дате отправления:

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: BUG #4668: Windows installer package
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4670: Cannot get domain constraint names from psql