COPY command on a table column marked as GENERATED ALWAYS - Mailing list pgsql-hackers

From Ashutosh Sharma
Subject COPY command on a table column marked as GENERATED ALWAYS
Date
Msg-id CAE9k0PmDWjwjmnjKu=9HeamW6H6ybcb5sW4wCeQPdAm9yh3w4g@mail.gmail.com
Whole thread Raw
Responses Re: COPY command on a table column marked as GENERATED ALWAYS  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
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?

Here is the test-case for more clarity.

postgres=# create table tab_always  (i int generated always as identity, j int);
CREATE TABLE

postgres=# insert into tab_always values(1, 10);
ERROR:  cannot insert into column "i"
DETAIL:  Column "i" is an identity column defined as GENERATED ALWAYS.
HINT:  Use OVERRIDING SYSTEM VALUE to override.

[ashu@localhost bin]$ cat /tmp/always.csv
13    10
14    20
15    30
16    40

postgres=# copy tab_always from '/tmp/always.csv';
COPY 4
postgres=# select * from tab_always;
 i  | j
----+----
 13 | 10
 14 | 20
 15 | 30
 16 | 40
(4 rows)

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



pgsql-hackers by date:

Previous
From: Jehan-Guillaume de Rorthais
Date:
Subject: Re: pg_walfile_name_offset can return inconsistent values
Next
From: Amit Kapila
Date:
Subject: Re: POC: Cleaning up orphaned files using undo logs