Re: COPY for CSV documentation

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: COPY for CSV documentation
Дата
Msg-id 200404121430.i3CEUMG05539@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: COPY for CSV documentation  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: COPY for CSV documentation  (Bruno Wolff III <bruno@wolff.to>)
Re: COPY for CSV documentation  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-patches
Andrew Dunstan wrote:
> Tom Lane wrote:
>
> >Bruno Wolff III <bruno@wolff.to> writes:
> >
> >
> >>On Mon, Apr 12, 2004 at 02:26:14 -0400,
> >>  Andrew Dunstan <andrew@dunslane.net> wrote:
> >>
> >>
> >>>a few points:
> >>>. in CSV mode, NULL should default to '' - that was in what I sent in.
> >>>
> >>>
> >
> >
> >
> >>Postgres normally treats an empty string as an empty string. Are you sure
> >>you really want it to be treated as a NULL by default in this one place?
> >>
> >>
> >
> >I think that's a spectacularly bad idea too.  People who really want
> >that can write "NULL ''", but it shouldn't be implied by CSV mode.
> >
> >
> >
>
> Spectacularly? Hmm.
>
> My approach was that the default should be the most common case. Perhaps
> on import it's a tossup, but on export a CSV containing lots of \N cells
> is likely to be ... unexpected.
>
> But, honestly, it's not worth dying in a ditch over.

It is my understanding that \N is a valid column value (no backslash
escape in CSV, right?), so we can't use it for NULL.

The only thing I can think of is for NULL to be:

    ,,

(no quotes) and a zero-length string to be:

    ,"",

How do most applications handle those two cases?  If they accept either,
can we use that so we can read our own CSV files without losing the NULL
specification?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-patches по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: COPY for CSV documentation
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: COPY for CSV documentation