Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode
Date
Msg-id CAB7nPqQ5i3-ccXuPBu6dzP=TRDkTrun++fF4kgAYzvthrmjQyA@mail.gmail.com
Whole thread Raw
In response to Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
On Wed, Mar 5, 2014 at 11:58 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> So if we specify both this produces the exact opposite of the default,
> default being an empty string inserted for a quoted empty string and
> NULL inserted for a non-quoted empty string. So yes I'm fine with a
> note on the docs about that, and some more regression tests.

For people who did not get this one, here is a short example:
=# ¥pset null 'null'
Null display (null) is "null".
=# create table aa (a text);
CREATE TABLE
=# COPY aa FROM STDIN WITH (FORMAT csv);
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> ""
>>
>> \.
=# select * from aa; a
------
null
(2 rows)
=# truncate aa;
TRUNCATE TABLE
Time: 12.149 ms
=# COPY aa FROM STDIN
WITH (FORMAT csv, FORCE_NULL(a), FORCE_NOT_NULL(a));
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.
>> ""
>>
>> \.
Time: 3776.662 ms
=# select * from aa; a
------null

(2 rows)
--
Michael



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Review: Patch FORCE_NULL option for copy COPY in CSV mode
Next
From: Pavel Stehule
Date:
Subject: Re: Fwd: patch: make_timestamp function