Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties - Mailing list pgsql-bugs

From Shay Rojansky
Subject Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties
Date
Msg-id CADT4RqCQctfmr1rd9u72HEkw-PN9OQMSw=4UZM_4cA22viZ9fw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties  (Shay Rojansky <roji@roji.org>)
List pgsql-bugs
> I'll go adjust that

Thanks Tom.

> so the spec does clearly say that both alternatives force NOT NULL.

For what it's worth, it's odd to disallow nullable columns which are also GENERATED BY DEFAULT AS IDENTITY - unless I'm missing something, it seems like quite an artificial restriction for a legitimate scenario. After all, we can do:

CREATE SEQUENCE foo_seq AS integer;
CREATE TABLE foo (
    bar INTEGER NULL DEFAULT nextval('foo_seq')
);

... which is logically very similar, and definitely seems useful. Would it make sense to allow nullable GENERATED BY DEFAULT AS IDENTITY as a PG extension?

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #17007: server process (PID XXXX) was terminated by signal 11: Segmentation fault
Next
From: Shay Rojansky
Date:
Subject: Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties