From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, 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-14 03:39:00 |
Message-ID: | 31740.1513222740@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> On Fri, Dec 8, 2017 at 2:13 AM, Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>> 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.
Now that I look more closely at this patch, isn't it fixing things
in the wrong place? Why is it that COPY needs to know about this,
rather than build_column_default()? Aren't we going to have to
fix every other caller of build_column_default()?
For that matter, should build_column_default() know about it explicitly
either? Why aren't we implementing IDENTITY by storing an appropriate
default expression in the catalogs?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2017-12-14 04:22:03 | Re: BUG #14952: COPY fails to fill in IDENTITY column default value |
Previous Message | Michael Paquier | 2017-12-14 00:18:49 | Re: BUG #14970: Foreign Data Wrapper for windows |