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

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: [HACKERS] Bug or feature? COPY ignores column defaults
Дата
Msg-id m105sZ6-000EBQC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на Re: [HACKERS] Bug or feature? COPY ignores column defaults  (Vadim Mikheev <vadim@krs.ru>)
Список pgsql-hackers
>
> Oliver Elphick wrote:
> >
> > At release 6.4.2, COPY does not respect column defaults:
> >
> > INSERT works correctly, however.
> >
> > Is this intentional, or a bug?
>
> This is standard behaviour. DEFAULT value is sabstituted
> only if column value (including NULL) is not specified in
> INSERT statement.

    And  so  for  the  rule system. It is not invoked on COPY, so
    rewrite rules don't take effect.

    If you want some columns to have defaults assigned  when  the
    value  in  COPY  is  NULL, or maybe override something like a
    timestamp field, you could define  a  trigger.  Triggers  are
    called from COPY.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

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

Предыдущее
От: "Reiner Nippes"
Дата:
Сообщение: (Fwd) Re: [ADMIN] Running Postgres on a HP-Ux 10.10 System
Следующее
От: Massimo Dal Zotto
Дата:
Сообщение: Re: [HACKERS] Postgres Speed or lack thereof