Re: COPY WITH CSV FORCE QUOTE *

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: COPY WITH CSV FORCE QUOTE *
Дата
Msg-id 4A5F7EE2.5000704@dunslane.net
обсуждение исходный текст
Ответ на Re: COPY WITH CSV FORCE QUOTE *  (Josh Berkus <josh@agliodbs.com>)
Ответы Re: COPY WITH CSV FORCE QUOTE *  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers

Josh Berkus wrote:
> Andrew,
>
>> FORCE NOT NULL is in any case a fairly blunt instrument - it doesn't
>> work for a column of any type that doesn't accept an empty string as
>> valid input, such as numeric types.
>
> Con: this allows COPY to produce output which cannot be reloaded into 
> PostgreSQL.
>
> Pro: there is a lot of extremely broken external software which 
> expects "nulls" to be expressed as "".  This improves compatiblity 
> with them.
>

FORCE NOT NULL is only valid when we import data, not when we export 
data, so what other programs expect to receive is irrelevant to any 
argument about FORCE NOT NULL.

AFAICT on a brief look at the patch, it doesn't affect the quoting of 
nulls on export, it just allows * as an alias for all columns for FORCE 
QUOTE (as well as FORCE NOT NULL). But FORCE QUOTE has never forced 
quoting of null values, only non-null values. We have never quoted null 
values, and I'm fairly resistant to any suggestion that we should.

As for importing data from programs that produce all values in quotes 
including null/missing values (your pro case above), arguably what we 
need is another flag that would turn an empty string into a null.

cheers

andrew


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

Предыдущее
От: Rick Gigger
Дата:
Сообщение: Re: Synch Rep for CommitFest 2009-07
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: pg_stat_activity.application_name