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.)