Re: Catalog domain not-null constraints

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Catalog domain not-null constraints
Дата
Msg-id CAEZATCXM+Fgw7Ge8ApzmG1Z_FZR1psNXWb3K_QuSk6zgOwGA7w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Catalog domain not-null constraints  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
On Tue, 26 Mar 2024 at 07:30, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2024-Mar-25, Dean Rasheed wrote:
>
> > Also (not this patch's fault), psql doesn't seem to offer a way to
> > display domain constraint names -- something you need to know to drop
> > or alter them. Perhaps \dD+ could be made to do that?
>
> Ooh, I remember we had offered a patch for \d++ to display these
> constraint names for tables, but didn't get around to gather consensus
> for it.  We did gather consensus on *not* wanting \d+ to display them,
> but we need *something*.  I suppose we should do something symmetrical
> for tables and domains.  How about \dD++ and \dt++?
>

Personally, I quite like the fact that \d+ displays NOT NULL
constraints, because it puts them on an equal footing with CHECK
constraints. However, I can appreciate that it will significantly
increase the length of the output in some cases.

With \dD it's not so nice because of the way it puts all the details
on one line. The obvious output might look something like this:

\dD
                                       List of domains
 Schema | Name |  Type   | Collation | Nullable | Default |      Check
--------+------+---------+-----------+----------+---------+-------------------
 public | d1   | integer |           | NOT NULL |         | CHECK (VALUE > 0)

\dD+
                                                        List of domains
 Schema | Name |  Type   | Collation |             Nullable
| Default |                Check                  | Access privileges
| Description

--------+------+---------+-----------+---------------------------------+---------+---------------------------------------+-------------------+-------------
 public | d1   | integer |           | CONSTRAINT d1_not_null NOT NULL
|         | CONSTRAINT d1_check CHECK (VALUE > 0) |
|

So you'd need quite a wide window to easily view it (or use \x). I
suppose the width could be reduced by dropping the word "CONSTRAINT"
in the \dD+ case, but it's probably still going to be wider than the
average window.

Regards,
Dean



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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Introduce XID age and inactive timeout based replication slot invalidation
Следующее
От: Bertrand Drouvot
Дата:
Сообщение: Re: pgsql: Track last_inactive_time in pg_replication_slots.