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


Reply via email to