Re: Updated COPY CSV patch

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Updated COPY CSV patch
Дата
Msg-id 2748.24.211.141.25.1081855939.squirrel@www.dunslane.net
обсуждение исходный текст
Ответ на Updated COPY CSV patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: Updated COPY CSV patch  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-patches
Bruce Momjian said:
> Second, I found a problem with NULLs.  If I do:
> .
>        test=> create table test (x text, y text);
>        CREATE TABLE
>        test=> insert into test values ('', NULL);
>        INSERT 17221 1
>        test=>
>
> then this:
>
>        test=> copy test to '/tmp/b' with csv;
>
> creates:
>
>        "",
>
> and this:
>
>        test=> copy test to '/tmp/b' with csv NULL 'fred';
>
> creates:
>
>        ,fred
>
> Is that logical?  A non-null field went from "" to nothing.
>

One more point about this - we can't force quoting of every non-null
value, which would remove the "inconsistency" you see here, because
spreadsheets especially infer information from whether or not a CSV value
is quoted. In particular, they will not usually treat a quoted numeric
value as numeric, which would be a very undesirable effect.

cheers

andrew



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

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