Re: Bug: Cannot insert multiple records using DEFAULT keyword for generated column

From: Ryan Vinzent <ryan(dot)vinzent(at)invitae(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Bug: Cannot insert multiple records using DEFAULT keyword for generated column
Date: 2021-02-25 00:39:00
Message-ID: CAJJLo9VgTFdsK7xk9LZOnzjk5A67Rpqeze1dX=qCda+km7PVpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks!

If there are no plans to back-patch as a bug, then some added clarity in
documentation of the affected versions would be very helpful. The line
regarding inserts with the DEFAULT keyword gives no mention of
different behavior between multi row inserts and single row inserts, so I
feel it's fair for users to assume both work given the current wording.

Something like this would make it clear.

A generated column cannot be written to directly. In INSERT or UPDATE
> commands, a value cannot be specified for a generated column, but the
> keyword DEFAULT may be specified *for single row inserts only*.

Regards,
Ryan

On Wed, Feb 24, 2021 at 2:05 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ryan Vinzent <ryan(dot)vinzent(at)invitae(dot)com> writes:
> > I have run into an issue and I'm fairly sure this can be classified as a
> bug.
>
> More an unimplemented feature ...
>
> > INSERT INTO
> > "generated_column_table" ("name", "id_plus_one")
> > VALUES
> > ('some text', DEFAULT),
> > ('other text', DEFAULT);
> >
> > ERROR: cannot insert into column "id_plus_one"
> > DETAIL: Column "id_plus_one" is a generated column.
>
> This works in HEAD, as of
>
>
> https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=17958972f
>
> but there hasn't been any discussion of back-patching that.
>
> regards, tom lane
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2021-02-25 01:30:41 Re: BUG #16801: Invalid memory access on WITH RECURSIVE with nested WITHs
Previous Message Tom Lane 2021-02-25 00:36:26 Re: BUG #16801: Invalid memory access on WITH RECURSIVE with nested WITHs