Re: Catalog domain not-null constraints
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: jian he <jian.universality@gmail.com>,
Peter Eisentraut <peter@eisentraut.org>, Aleksander Alekseev <aleksander@timescale.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>, vignesh C <vignesh21@gmail.com>
Date: 2024-03-26T09:04:20Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix ALTER DOMAIN NOT NULL syntax
- 9895b35cb88e 17.0 landed
-
Catalog domain not-null constraints
- e5da0fe3c22b 17.0 landed
-
Add tests for domain-related information schema views
- 9578393bc513 17.0 landed
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