Re: Triggers

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Triggers
Дата
Msg-id 7414.1029507242@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Triggers  (Oliver Elphick <olly@lfix.co.uk>)
Ответы Re: Triggers  (Oliver Elphick <olly@lfix.co.uk>)
Список pgsql-general
Oliver Elphick <olly@lfix.co.uk> writes:
>> Unfortunately the column is defined as not null so I fear the insert
>> would fail and the trigger never get called. How can I get around this?

> Surely you can use a BEFORE trigger, can't you?

I think we check constraints (including NOT NULL) before firing
triggers.

The simple answer to this is not to use a constraint, but to rely on
insert and update triggers to substitute for a null (or throw an error)
in that column.

            regards, tom lane

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

Предыдущее
От: Roj Niyogi
Дата:
Сообщение: Re: Good PL/pgSQL ressources>
Следующее
От: Jean-Christian Imbeault
Дата:
Сообщение: Re: Triggers