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

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #19403: psql fails when trying to import a file that
Дата
Msg-id 19403-59b4099e771c1f2e@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #19403: psql fails when trying to import a file that
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19403
Logged by:          Daniel Adeniji
Email address:      daniel_adeniji@hotmail.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





В списке pgsql-bugs по дате отправления: