Re: Plan for CSV handling of quotes, NULL

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Plan for CSV handling of quotes, NULL
Date: 2004-04-15 15:08:49
Message-ID: 407EA581.6010804@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Bruce Momjian wrote:

>Andrew Dunstan wrote:
>
>
>>Bruce Momjian wrote:
>>
>>
>>
>>>What about NULL input? Is my warning and promotion to zero-length
>>>string for NOT NULL columns OK?
>>>
>>>
>>>
>>>
>>>
>>I know I originally floated this idea or one very like it, but I have
>>become convinced it is not a good idea after all. The user might not
>>know or expect that the data file has nulls, in which case promoting the
>>value might not be what s/he expects at all. I think there's a world of
>>difference between the user saying "I know there might be nulls in this
>>CSV column - ignore them" and us doing it automagically and issuing a
>>warning, which might elicit the response "Doh! I wish you'd told me
>>beforehand." If we provide an option to override handling of nulls on
>>input per column, then we can safely fail on encountering an unexpected
>>null, and all the user will have to do would be to rerun the command
>>with the override. Recovering from an unexpected promotion to non-null
>>would be a lot harder.
>>
>>
>
>OK, so we need a list of columns for output with quotes, and a list of
>columns where NULL should be changed to zero-length strings.
>
>How about if we use FORCE to force quotes on output, and CONVERT to
>convert null to zero-length strings on input?
>
>
>

Works for me. I think I would be inclined just to use whatever
null_print happens to be, rather than make empty string magical. In the
usual case they would be the same.

cheers

andrew

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Richard Huxton 2004-04-16 00:00:33 Re: Plan for CSV handling of quotes, NULL
Previous Message Bruce Momjian 2004-04-15 14:58:31 Re: Plan for CSV handling of quotes, NULL