From: | "asaba(dot)takanori(at)fujitsu(dot)com" <asaba(dot)takanori(at)fujitsu(dot)com> |
---|---|
To: | 'Surafel Temesgen' <surafel3000(at)gmail(dot)com> |
Cc: | 'Tatsuo Ishii' <ishii(at)sraoss(dot)co(dot)jp>, Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Anthony Nowocien <anowocien(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | RE: Conflict handling for COPY FROM |
Date: | 2020-03-06 08:30:03 |
Message-ID: | OSBPR01MB47287299909583B6E26F39A28CE30@OSBPR01MB4728.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello Surafel,
Sorry for my late reply.
From: Surafel Temesgen <surafel3000(at)gmail(dot)com>
>On Thu, Dec 12, 2019 at 7:51 AM mailto:asaba(dot)takanori(at)fujitsu(dot)com <mailto:asaba(dot)takanori(at)fujitsu(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Korotkov | 2020-03-06 08:46:26 | Re: Psql patch to show access methods info |
Previous Message | Michael Paquier | 2020-03-06 08:22:16 | Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line |