Re: Catalog domain not-null constraints

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: jian he <jian.universality@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>, vignesh C <vignesh21@gmail.com>, Aleksander Alekseev <aleksander@timescale.com>
Date: 2024-03-14T14:35:52Z
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 →
  1. Fix ALTER DOMAIN NOT NULL syntax

  2. Catalog domain not-null constraints

  3. Add tests for domain-related information schema views

On 14.03.24 15:03, Alvaro Herrera wrote:
> On 2024-Mar-14, Peter Eisentraut wrote:
> 
>> Perhaps it would make sense if we change the ALTER TABLE command to be like
>>
>>      ALTER TABLE t1 ADD IF NOT EXISTS NOT NULL c1
>>
>> Then the behavior is like one would expect.
>>
>> For ALTER TABLE, we would reject this command if IF NOT EXISTS is not
>> specified.  (Since this is mainly for pg_dump, it doesn't really matter for
>> usability.)  For ALTER DOMAIN, we could accept both variants.
> 
> I don't understand why you want to change this behavior, though.

Because in the abstract, the behavior of

     ALTER TABLE t1 ADD <constraint specification>

should be to add a constraint.

In the current implementation, the behavior is different for different 
constraint types.