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: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Catalog domain not-null constraints
Date: 2023-11-27 07:08:08
Message-ID: 99adc944-bcc1-41bb-ae59-a10fb345f5dc@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.11.23 17:38, Alvaro Herrera wrote:
> If you create a table with column of domain that has a NOT NULL
> constraint, what happens? I mean, is the table column marked
> attnotnull, and how does it behave?

No, the domain does not affect the catalog entry for the column. This
is the same way it behaves now.

> Is there a separate pg_constraint
> row for the constraint in the table? What happens if you do
> ALTER TABLE ... DROP NOT NULL for that column?

Those are separate. After dropping the NOT NULL for a column, null
values for the column could still be rejected by a domain. (This is the
same way CHECK constraints work.)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-11-27 07:11:06 Re: [PATCH] pg_convert improvement
Previous Message jian he 2023-11-27 07:05:57 Re: Improve rowcount estimate for UNNEST(column)