From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Shay Rojansky <roji(at)roji(dot)org> |
Cc: | Vik Fearing <vik(at)postgresfriends(dot)org>, Amit Langote <amitlangote09(at)gmail(dot)com>, pavel(dot)boev(at)invitae(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties |
Date: | 2021-05-14 21:18:40 |
Message-ID: | 2194411.1621027120@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
I wrote:
> GENERATED BY DEFAULT does create a NOT NULL constraint:
> ...
> so I think the patch is doing what it was intended to. Whether GENERATED
> BY DEFAULT *should* be forcing NOT NULL is a separate question, but
> AFAIK it always has.
Ah, found it. SQL:2016 11.4 <column definition> syntax rule 16 saith:
If <identity column specification> ICS is specified, then:
...
d) The <column constraint definition> NOT NULL NOT DEFERRABLE is implicit.
The <identity column specification> production includes both cases:
<identity column specification> ::=
GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY
[ <left paren> <common sequence generator options> <right paren> ]
so the spec does clearly say that both alternatives force NOT NULL.
So, it was my error to write the release notes as though only
GENERATED ALWAYS is affected. I'll go adjust that, though
it won't propagate to the website for another three months :-(
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2021-05-14 22:10:01 | Re: BUG #16833: postgresql 13.1 process crash every hour |
Previous Message | Tom Lane | 2021-05-14 20:18:02 | Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties |