Re: AFTER triggers and constraints

Поиск
Список
Период
Сортировка
От David Greco
Тема Re: AFTER triggers and constraints
Дата
Msg-id 187F6C10D2931A4386EE8E58E13857F630438BD2@BY2PRD0811MB415.namprd08.prod.outlook.com
обсуждение исходный текст
Ответ на Re: AFTER triggers and constraints  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: AFTER triggers and constraints  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-general
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Friday, June 28, 2013 10:10 AM
To: David Greco
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] AFTER triggers and constraints

David Greco <David_Greco@harte-hanks.com> writes:
> Since the trigger is defined as AFTER ROW, versus AFTER STATEMENT, I believe the trigger should be considered part of
thestatement, therefore the constraint should not be checked until after the row triggers have run. Any thoughts? 

Not sure that this is terribly well documented, but you can arrange for your triggers to fire before the FK-enforcement
triggers. Triggers on the same table and event type fire in alphabetical (in ASCII) order, so just choose a name that's
beforethe FK triggers, which if memory serves have names starting with "RI_".  So for instance 
    CREATE TRIGGER "Parent_ar_trg" ...
would have worked the way you want.

            regards, tom lane




Thanks Tom,

Yes, renaming the trigger does in fact work. Any thoughts on the theory of this behavior? i.e. is this ANSI compliant?
Orshould there be a mechanism in place that guarantees the FK-enforcement trigger runs after all others? 





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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: AFTER triggers and constraints
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: AFTER triggers and constraints