[BUGS] Line number in error message is incorrect when loading a CSV-filewith multi-line records. - Mailing list pgsql-bugs

From Patrick van Coeverden
Subject [BUGS] Line number in error message is incorrect when loading a CSV-filewith multi-line records.
Date
Msg-id 08f86723-0672-eecb-900a-930960d7e6ec@topicus.nl
Whole thread Raw
List pgsql-bugs
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

Attachment

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: [BUGS] BUG #14800: substring produces different results withsimilar types
Next
From: Thomas Munro
Date:
Subject: Re: [BUGS] BUG #14799: SELECT * FROM transition_table in astatement-level trigger