Re: [POC] Fast COPY FROM command for the table with foreign partitions

Поиск
Список
Период
Сортировка
От Andrey Lepikhov
Тема Re: [POC] Fast COPY FROM command for the table with foreign partitions
Дата
Msg-id 2a33a068-749c-4c18-ba74-bd6fbf37abce@postgrespro.ru
обсуждение исходный текст
Ответ на Re: [POC] Fast COPY FROM command for the table with foreign partitions  (Amit Langote <amitlangote09@gmail.com>)
Ответы RE: [POC] Fast COPY FROM command for the table with foreign partitions
Список pgsql-hackers
This patch currently looks very ready for use. And I'm taking a close 
look at the error reporting. Here we have difference in behavior of 
local and foreign table:

regression test in postgres_fdw.sql:
copy rem2 from stdin;
-1    xyzzy
\.

reports error (1):
=================
ERROR:  new row for relation "loc2" violates check constraint...
DETAIL:  Failing row contains (-1, xyzzy).
CONTEXT:  COPY loc2, line 1: "-1    xyzzy"
remote SQL command: COPY public.loc2(f1, f2) FROM STDIN
COPY rem2, line 2

But local COPY into loc2 reports another error (2):
===================================================
copy loc2 from stdin;
ERROR:  new row for relation "loc2" violates check constraint...
DETAIL:  Failing row contains (-1, xyzzy).
CONTEXT:  COPY loc2, line 1: "-1    xyzzy"

Report (2) is shorter and more specific.
Report (1) contains meaningless information.

Maybe we need to improve error report? For example like this:
ERROR: Failed COPY into foreign table "rem2":
new row for relation "loc2" violates check constraint...
DETAIL:  Failing row contains (-1, xyzzy).
remote SQL command: COPY public.loc2(f1, f2) FROM STDIN
COPY rem2, line 1

The problem here is that we run into an error after the COPY FROM 
command completes. And we need to translate lineno from foreign server 
to lineno of overall COPY command.

-- 
regards,
Andrey Lepikhov
Postgres Professional



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

Предыдущее
От: Dilip Kumar
Дата:
Сообщение: Re: Logical replication from PG v13 and below to PG v14 (devel version) is not working.
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: [HACKERS] logical decoding of two-phase transactions