Re: BUG #16913: GENERATED AS IDENTITY column nullability is affected by order of column properties

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, 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-03-12 15:30:48
Message-ID: 2441173.1615563048@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Amit Langote <amitlangote09(at)gmail(dot)com> writes:
> On Thu, Mar 11, 2021 at 11:37 PM Vik Fearing <vik(at)postgresfriends(dot)org> wrote:
>> On 3/4/21 3:22 PM, Vik Fearing wrote:
>>> I can confirm this bug. Attached is a patch to prevent it.

>> Would anybody like to take a look at this?

> Patch looks reasonable to me.

I think it's not really necessary to have two different tests; we can
just make the code for IDENTITY include exactly what the code for
CONSTR_NOTNULL does, ie it can set saw_not_null too. The point here
is that IDENTITY can be read as implicitly including NOT NULL, so we
can just act as though that was explicit.

An alternative fix approach is to add to the list of conflict checks
that are made after the loop, but I'm not sure that's any better.

Will push it in a bit.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Regina Obe 2021-03-12 16:48:31 RE: BUG #16920: Can't compile PostGIS with MingW64 against PostgreSQL 14 head
Previous Message Tom Lane 2021-03-12 15:03:17 Re: Invalid idle_in_transaction_session_timeout data type