Re: Need "InBetween" (not just Before and After) Trigger

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Need "InBetween" (not just Before and After) Trigger
Дата
Msg-id 20010113161647.B28414@wolff.to
обсуждение исходный текст
Ответ на Need "InBetween" (not just Before and After) Trigger  (Matt Doucleff <matt@digitalfountain.com>)
Список pgsql-general
On Sat, Jan 13, 2001 at 01:23:27PM -0800,
  Matt Doucleff <matt@digitalfountain.com> wrote:
>
> If I use a "before" trigger, the constraints are checked after I've already
> performed my action.  Thus I have performed my action yet no row is inserted
> (which is inconsistent).
>
> If I use an "after" trigger, the constraints are checked first.  If the row is
> inserted, I attempt to perform my action.  If my action fails, then I have an
> inserted row but no action, which is also inconsistent.
>
> The only solution I've developed involves a duplicate table and a transaction.

I think what you want to do is defer constraint checking until the end of
a transaction. You can make a constraint deferable and make the default for
it to be checked at the end of a transaction instead of immediately after
a change.

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

Предыдущее
От: Matt Doucleff
Дата:
Сообщение: Need "InBetween" (not just Before and After) Trigger
Следующее
От: Uro Gruber
Дата:
Сообщение: Compare dates.