Re: BUG #14952: COPY fails to fill in IDENTITY column default value

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, steven(dot)winfield(at)cantabcapital(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14952: COPY fails to fill in IDENTITY column default value
Date: 2017-12-27 20:01:37
Message-ID: f1d4c6aa-d91b-ebc8-c249-17d7c847ac3b@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 12/18/17 00:49, Michael Paquier wrote:
> I have a problem with this approach which is basically something
> similar to what I complained in the thread about typed and partition
> tables for identity columns
> (https://www.postgresql.org/message-id/20171023074458.1473.25799@wrigleys.postgresql.org).
> In my opinion, this ALTER TABLE handling should be done by treating
> identity columns a way similar to default expressions in
> transformColumnDefinition(), by storing the FuncExpr node at parsing
> time instead of storing the information needed to rebuild it when
> executing the query. In short the mapping should get closer to what
> default does with nextval or serial.

The serial case works because it stores the sequence *name* in the
default value in the catalog. That doesn't work because for the
identity case we don't store the expression in the catalog. The
proposed patch works by storing the sequence *name* in the internal
structures so that it can be used in place of the stored default value.
So I think this approach is pretty consistent.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-12-27 20:43:05 Re: BUG #14952: COPY fails to fill in IDENTITY column default value
Previous Message PG Bug reporting form 2017-12-27 18:37:30 BUG #14993: no inicia