Hello,
I am importing CSV files into a Postgres database with the COPY statement.
Some of the CSV files do have records that span over multiple lines.
These records are surrounded by double-quotes.
This imports fine when there are no errors.
However, when an error is thrown because of an unique constraint, the
line number in the error message is off.
I have attached an example CSV and SQL file.
When executing the attached SQL-file (change the location of the CSV),
the following error message appears:
ERROR: duplicate key value violates unique constraint "import_test_pkey"
DETAIL: Key (id)=(3) already exists.
CONTEXT: COPY import_test, line 13
However, the error in the CSV is located at line 23 (Or the 4th record)
Postgres version: "PostgreSQL 9.6.5 on x86_64-pc-linux-gnu, compiled by
gcc (Debian 4.7.2-5) 4.7.2, 64-bit"
OS: Linux Mint
Thanks,
Patrick van Coeverden
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs