Re: Catalog domain not-null constraints

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>, Aleksander Alekseev <aleksander(at)timescale(dot)com>
Subject: Re: Catalog domain not-null constraints
Date: 2024-03-14 14:35:52
Message-ID: 565a720a-80c8-44f6-954c-9ab2c023988e@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-03-14 14:36:39 Re: Should we remove -Wdeclaration-after-statement?
Previous Message Robert Haas 2024-03-14 14:27:54 Re: [DOCS] HOT - correct claim about indexes not referencing old line pointers