From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | 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-08 01:37:15 |
Message-ID: | CAB7nPqTMCmO_Y3HcQn9-oKFQBcWXckf24urAk+_ifBjfjhD0sA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Fri, Dec 8, 2017 at 2:13 AM, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 12/7/17 06:29, steven(dot)winfield(at)cantabcapital(dot)com wrote:
>> COPYing data to a table with an IDENTITY column, where the column's value
>> isn't specified in the copied input, fails because COPY attempts to insert a
>> NULL value for the column:
>
> That indeed appears to be a bug.
That's a bug. When doing a COPY with or without a list of columns, and
that a column is not listed and has a default expression, then this
expression is used. This is a role filled in by build_column_default()
but identity columns need to create a NextValueExpr expression
instead. As this expression is missing, the backend complains about a
NULL input for this column, which is logic without an expression.
Attached is a patch with a regression test.
Peter, what do you think?
Thanks,
--
Michael
Attachment | Content-Type | Size |
---|---|---|
copy-identity-fix.patch | application/octet-stream | 2.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-12-08 02:08:12 | Re: PostgreSQL crashes with SIGSEGV |
Previous Message | Thomas Munro | 2017-12-07 21:45:43 | Re: BUG in 10.1 - dsa_area could not attach to a segment that has been freed |