Re: Patch: FORCE_NULL option for copy COPY in CSV mode

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: FORCE_NULL option for copy COPY in CSV mode
Date: 2013-10-07 19:25:14
Message-ID: 52530A9A.6060903@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-10-07 19:32:21 Re: SSI freezing bug
Previous Message Robert Haas 2013-10-07 19:06:42 Re: Patch: FORCE_NULL option for copy COPY in CSV mode