From: | Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | COPY command on a table column marked as GENERATED ALWAYS |
Date: | 2019-07-26 09:42:28 |
Message-ID: | CAE9k0PmDWjwjmnjKu=9HeamW6H6ybcb5sW4wCeQPdAm9yh3w4g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)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
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2019-07-26 09:45:33 | Re: POC: Cleaning up orphaned files using undo logs |
Previous Message | Jehan-Guillaume de Rorthais | 2019-07-26 09:30:19 | Re: pg_walfile_name_offset can return inconsistent values |