Re: Statement-level Triggers For Uniqueness Checks
| От | Dean Rasheed |
|---|---|
| Тема | Re: Statement-level Triggers For Uniqueness Checks |
| Дата | |
| Msg-id | CAEZATCWYhOFEBA+2P3pMnWhjE4xvUO85yt+1XZUHnsD8NLX0sA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Statement-level Triggers For Uniqueness Checks (Corey Huinker <corey.huinker@gmail.com>) |
| Ответы |
Re: Statement-level Triggers For Uniqueness Checks
|
| Список | pgsql-hackers |
On Mon, 24 Dec 2018 at 23:57, Corey Huinker <corey.huinker@gmail.com> wrote:
>
> So I took a first pass at this, and I got stuck.
>
> [snip]
>
> Any idea where I went wrong?
Take a look at this code in AfterTriggerSaveEvent():
/*
* If the trigger is a deferred unique constraint check trigger, only
* queue it if the unique constraint was potentially violated, which
* we know from index insertion time.
*/
if (trigger->tgfoid == F_UNIQUE_KEY_RECHECK)
{
if (!list_member_oid(recheckIndexes, trigger->tgconstrindid))
continue; /* Uniqueness definitely not violated */
}
If you trace it back, you'll see that for a statement-level trigger,
recheckIndexes will always be empty.
Regards,
Dean
В списке pgsql-hackers по дате отправления: