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

From Andrew Dunstan
Subject Re: Patch: FORCE_NULL option for copy COPY in CSV mode
Date
Msg-id 52530A9A.6060903@dunslane.net
Whole thread Raw
In response to Re: Patch: FORCE_NULL option for copy COPY in CSV mode  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Patch: FORCE_NULL option for copy COPY in CSV mode
List pgsql-hackers
On 10/07/2013 03:06 PM, Robert Haas wrote:
>
>> Also if your use case is to treat empty strings as NULL (as per above
>> documentation), can't it be handled with "WITH NULL AS" option.
>> For example, something like:
>>
>> postgres=# COPY testnull FROM stdin with CSV NULL AS E'';
>> Enter data to be copied followed by a newline.
>> End with a backslash and a period on a line by itself.
>>>> 50,
>>>> \.
>> postgres=# select * from testnull;
>>   a  |  b
>> ----+------
>>   50 | NULL
>> (1 row)
> Good point.  If this patch is just implementing something that can
> already be done with another syntax, we don't need it.
>


Isn't the point of this option to allow a *quoted* empty string to be 
forced to NULL? If so, this is not testing the same case - in fact the 
COPY command above just makes explicit the default CSV NULL setting anyway.

cheers

andrew




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Patch: FORCE_NULL option for copy COPY in CSV mode
Next
From: Robert Haas
Date:
Subject: Re: plpgsql.print_strict_params