Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a189ed4

Browse files
committed
Add tests for more row patterns with COPY FROM .. (ON_ERROR ignore)
While digging into the code of this feature, I got confused by the fact that a line is skipped when a value cannot be converted to its expected attribute even if the line has fewer attributes than the target relation. The tests had a check for the case of an empty line, this commit a couple more patterns where a line is incomplete, but skipped because of a conversion error. Reviewed-by: Bharath Rupireddy Discussion: https://postgr.es/m/Ze_7kZqexdt0BiyC@paquier.xyz
1 parent 0b84f5c commit a189ed4

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/test/regress/expected/copy2.out

+3-2
Original file line numberDiff line numberDiff line change
@@ -730,13 +730,14 @@ COPY check_ign_err FROM STDIN WITH (on_error stop);
730730
ERROR: invalid input syntax for type integer: "a"
731731
CONTEXT: COPY check_ign_err, line 2, column n: "a"
732732
COPY check_ign_err FROM STDIN WITH (on_error ignore);
733-
NOTICE: 4 rows were skipped due to data type incompatibility
733+
NOTICE: 6 rows were skipped due to data type incompatibility
734734
SELECT * FROM check_ign_err;
735735
n | m | k
736736
---+-----+---
737737
1 | {1} | 1
738738
5 | {5} | 5
739-
(2 rows)
739+
8 | {8} | 8
740+
(3 rows)
740741

741742
-- test datatype error that can't be handled as soft: should fail
742743
CREATE TABLE hard_err(foo widget);

src/test/regress/sql/copy2.sql

+3
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,9 @@ a {2} 2
515515
4 {a, 4} 4
516516

517517
5 {5} 5
518+
6 a
519+
7 {7} a
520+
8 {8} 8
518521
\.
519522
SELECT * FROM check_ign_err;
520523

0 commit comments

Comments
 (0)