Re: [fixed] Trigger test

From: Dmitrii Bondar <d(dot)bondar(at)postgrespro(dot)ru>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: ontowhee(at)gmail(dot)com
Subject: Re: [fixed] Trigger test
Date: 2025-03-26 09:45:33
Message-ID: 17a8a24f7295201873d105c5118024f5@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

Thank you for the review!

> 3. Consider updating documentation for doc/src/contrib-spi.sgml, or any
> file as appropriate, to reflect the changes.

The changes have now been added to doc/src/contrib-spi.sgml. I also
added a consideration note about interactions with BEFORE triggers.

> 4. Are there any cases where check_primary_key() and
> check_foreign_key() should be called using a BEFORE trigger? Will this
> change break backwards compatibility? Consider adding a test with a
> BEFORE trigger to ensure the error "must be fired by AFTER trigger" is
> raised.

The usage within BEFORE triggers appears to be entirely incorrect. The
functions check_primary_key() and check_foreign_key() are intended for
use in creating constraint triggers, which according to the
documentation must be AFTER ROW triggers. Therefore, any cases using
BEFORE triggers are invalid.

I have updated the test so that it now raises the error "must be fired
by AFTER trigger."

Can you also help me with the patch status? What status should I move
the patch to?

Attachment Content-Type Size
v5-0001-Triggers-test-fix-with-the-invalid-cache-in-refin.patch text/x-diff 15.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2025-03-26 09:49:50 Re: gamma() and lgamma() functions
Previous Message David Rowley 2025-03-26 09:44:46 Re: Reduce "Var IS [NOT] NULL" quals during constant folding