Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row - Mailing list pgsql-hackers

From Jim Jones
Subject Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row
Date
Msg-id b26e9c6c-75bf-45ea-8aea-346dda3bd445@uni-muenster.de
Whole thread Raw
In response to Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers

On 12.09.24 12:13, jian he wrote:
> please check the attached file.

v4 applies cleanly, it works as expected, and all tests pass.

postgres=# \pset null '(NULL)'
Null display is "(NULL)".

postgres=# CREATE TEMPORARY TABLE t2 (a int, b int);
CREATE TABLE

postgres=# COPY t2 (a,b) FROM STDIN WITH (on_error set_to_null, format csv);
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.
>> 1,a
>> 2,1
>> 3,2
>> 4,b
>> a,c
>> \.
COPY 5

postgres=# SELECT * FROM t2;
   a    |   b    
--------+--------
      1 | (NULL)
      2 |      1
      3 |      2
      4 | (NULL)
 (NULL) | (NULL)
(5 rows)


Perhaps small changes in the docs:

<literal>set_to_null</literal> means the input value will set to
<literal>null</literal> and continue with the next one.

"will set" -> "will be set"
"and continue with" -> "and will continue with"

Other than that, LGTM.

Thanks!

-- 
Jim




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Allow logical failover slots to wait on synchronous replication
Next
From: Ashutosh Bapat
Date:
Subject: Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN