RE: Conflict handling for COPY FROM

Поиск
Список
Период
Сортировка
От asaba.takanori@fujitsu.com
Тема RE: Conflict handling for COPY FROM
Дата
Msg-id OSBPR01MB47287299909583B6E26F39A28CE30@OSBPR01MB4728.jpnprd01.prod.outlook.com
обсуждение исходный текст
Ответ на Re: Conflict handling for COPY FROM  (Surafel Temesgen <surafel3000@gmail.com>)
Ответы Re: Conflict handling for COPY FROM  (Surafel Temesgen <surafel3000@gmail.com>)
Список pgsql-hackers
Hello Surafel,

Sorry for my late reply.

From: Surafel Temesgen <surafel3000@gmail.com> 
>On Thu, Dec 12, 2019 at 7:51 AM mailto:asaba.takanori@fujitsu.com <mailto:asaba.takanori@fujitsu.com> wrote:
>>2. I have a question about copy meta-command.
>>When I executed copy meta-command, output wasn't displayed.
>>Does it correspond to copy meta-command?
>
>Fixed 
Thank you.

I think we need regression test that constraint violating row is returned back to the caller.
How about this?

・ /src/test/regress/expected/copy2.out

@@ -1,5 +1,5 @@
 CREATE TEMP TABLE x (
-       a serial,
+       a serial UNIQUE,
        b int,
        c text not null default 'stuff',
        d text,
@@ -55,6 +55,16 @@ LINE 1: COPY x TO stdout WHERE a = 1;
                          ^
 COPY x from stdin WHERE a = 50004;
 COPY x from stdin WHERE a > 60003;
+COPY x from stdin WITH(ERROR_LIMIT 5);
+WARNING:  skipping "70001      22      32" --- missing data for column "d"
+WARNING:  skipping "70002      23      33      43      53      54" --- extra data after last expected column
+WARNING:  skipping "70003      24      34      44" --- missing data for column "e"
+
+     a    |  b    | c    |  d   |               e
+-------+----+----+----+----------------------
+ 70005 | 27  | 37  |  47  | before trigger fired
+(1 row)
+
 COPY x from stdin WHERE f > 60003;
 ERROR:  column "f" does not exist


・ src/test/regress/sql/copy2.sql

@@ -1,5 +1,5 @@
 CREATE TEMP TABLE x (
-       a serial,
+       a serial UNIQUE,
        b int,
        c text not null default 'stuff',
        d text,
@@ -110,6 +110,15 @@ COPY x from stdin WHERE a > 60003;
 60005  26      36      46      56
 \.

+COPY x from stdin WITH(ERROR_LIMIT 5);
+70001  22      32
+70002  23      33      43      53      54
+70003  24      34      44
+70004  25      35      45      55
+70005  26      36      46      56
+70005  27      37      47      57
+\.
+
 COPY x from stdin WHERE f > 60003;

 COPY x from stdin WHERE a = max(x.b);


Regards,

--
Takanori Asaba



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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [Patch] pg_rewind: options to use restore_command fromrecovery.conf or command line
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: Psql patch to show access methods info