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?