Re: [HACKERS] Bug or feature? COPY ignores column defaults

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Bug or feature? COPY ignores column defaults
Дата
Msg-id 24026.917553898@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Bug or feature? COPY ignores column defaults  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wrote:
> You ought to be getting something much like the result of

> play=> select '':int4;
> ERROR:  parser: parse error at or near ":"

Sheesh, need to learn to count my colons.  Of course, what I should've
written was:

play=> select ''::int4;
?column?
--------      0
(1 row)

which strikes me as being a bug in the INT4 text-to-value conversion
routine: it ought to be griping about bad input.  (float4 and float8
also seem overly permissive.)

The other thing COPY is evidently doing is substituting NULLs for
the remaining fields if it hits RETURN before getting the right number
of column separators.  I still say that's a bad idea, and that raising
a syntax error would be safer behavior.  COPY is not particularly
intended to be user-friendly, it's intended to be a simple and reliable
dump/reload syntax (no?).  Allowing omissions in order to ease typing
just makes the behavior less predictable.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Bug or feature? COPY ignores column defaults
Следующее
От: Bruce Momjian
Дата:
Сообщение: TEMP table code