Re: declare column update expression

Поиск
Список
Период
Сортировка
От Artacus
Тема Re: declare column update expression
Дата
Msg-id 48C9D908.7090007@comcast.net
обсуждение исходный текст
Ответ на Re: declare column update expression  ("Chris Velevitch" <chris.velevitch@gmail.com>)
Ответы Re: declare column update expression  ("Chris Velevitch" <chris.velevitch@gmail.com>)
Re: declare column update expression  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Список pgsql-general
> How is it that you can declare the default value of a column on insert
> but not on update?

You can do this without triggers (at least on 8.3).

UPDATE foo
SET field1  = 2,
    field2 = default
WHERE field3 = 22

I just tested it and it will set the value back to the default. The
caveat here is that it won't FORCE the value like it would with a
trigger. So while the trigger would happen automatically, using this
approach, you'd have to remember to also update that field any time you
did an update.

Artacus


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

Предыдущее
От: "Gauthier, Dave"
Дата:
Сообщение: Re: connection timeouts and "killing" users
Следующее
От: "Chris Velevitch"
Дата:
Сообщение: Re: declare column update expression