BUG #19403: psql fails when trying to import a file that

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: daniel_adeniji(at)hotmail(dot)com
Subject: BUG #19403: psql fails when trying to import a file that
Date: 2026-02-12 12:24:09
Message-ID: 19403-59b4099e771c1f2e@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19403
Logged by: Daniel Adeniji
Email address: daniel_adeniji(at)hotmail(dot)com
PostgreSQL version: 17.6
Operating system: MS Windows 10 ( PostgreSQL 17.6 on x86_64-windows
Description:

Database Table
--------------------
CREATE TABLE public.codeblock
(
id int4 NULL,
body text NULL
);

Text File
-----------
Id,Body
1,"{}
\.
"

Command
--------------
psql.exe --host --command "\copy public.codeblock from
'c:\tmp\codeblock.csv' WITH (HEADER, FORMAT CSV, ENCODING 'UTF8', DELIMITER
',' )"

Error Message reads:-

ERROR: unterminated CSV quoted field
CONTEXT: COPY codeblock, line 4: "1,"{}
\.
"

The same data works when inserted within an insert statement:-

delete

from public.codeblock

where id = 1;

insert into public.codeblock
(
Id,Body
)
values
(

1
,'{}
\.
'
)
;

It also works when the server-side copy statement is used:-

psql.exe --host --command "copy public.codeblock from
'c:\tmp\codeblock.csv' WITH (HEADER, FORMAT CSV, ENCODING 'UTF8', DELIMITER
',' )"

In the example above, \copy is replaced with the copy command and file is
availed on the server.

Data file availed at

1) One Compiler

https://onecompiler.com/text/44dbtdb52

2) GitLab

https://gitlab.com/-/snippets/5933548

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message surya poondla 2026-02-12 15:47:26 Re: Two issues with REFRESH MATERIALIZED VIEW CONCURRENTLY
Previous Message PG Bug reporting form 2026-02-12 08:16:38 BUG #19402: CREATE TABLE IF NOT EXISTS raises DuplicateTable error under concurrent partition creation