Re: COPY command on a table column marked as GENERATED ALWAYS

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: COPY command on a table column marked as GENERATED ALWAYS
Date: 2019-07-29 04:15:31
Message-ID: CAE9k0PnVHDQHE=-e=16LBzg9vg+iOoh7n30yFwJCPV07EZ9Dhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 29, 2019 at 7:27 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Jul 26, 2019 at 03:12:28PM +0530, Ashutosh Sharma wrote:
> > Hi All,
> >
> > I'm able to insert data into a table column marked as GENERATED ALWAYS
> > using COPY command however, it fails with INSERT command. Isn't that a
> > bug with COPY command?
>
> Per the documentation in the section for GENERATED ALWAYS:
> https://www.postgresql.org/docs/devel/sql-createtable.html
>
> "The clauses ALWAYS and BY DEFAULT determine how the sequence value is
> given precedence over a user-specified value in an INSERT
> statement. If ALWAYS is specified, a user-specified value is only
> accepted if the INSERT statement specifies OVERRIDING SYSTEM VALUE. If
> BY DEFAULT is specified, then the user-specified value takes
> precedence. See INSERT for details. (In the COPY command,
> user-specified values are always used regardless of this setting.)"
>
> So it behaves as documented.

Okay, Thanks for the pointer!

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-07-29 04:53:20 Re: ANALYZE: ERROR: tuple already updated by self
Previous Message John Naylor 2019-07-29 03:48:52 Re: [proposal] de-TOAST'ing using a iterator