1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Disallow referential integrity actions from being deferred; only the

NO ACTION check is deferrable.  This seems to be a closer approximation
to what the SQL spec says than what we were doing before, and it prevents
some anomalous behaviors that are possible now that triggers can fire
during the execution of PL functions.
Stephan Szabo.
This commit is contained in:
Tom Lane
2004-10-21 21:33:59 +00:00
parent 7627b91cd5
commit 12a47c6aca
4 changed files with 63 additions and 37 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.172 2004/09/10 18:39:56 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.173 2004/10/21 21:33:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -2729,11 +2729,17 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
/*
* If we found some, check that they fit the deferrability
* but skip ON <event> RESTRICT ones, since they are
* but skip referential action ones, since they are
* silently never deferrable.
*/
if (pg_trigger->tgfoid != F_RI_FKEY_RESTRICT_UPD &&
pg_trigger->tgfoid != F_RI_FKEY_RESTRICT_DEL)
pg_trigger->tgfoid != F_RI_FKEY_RESTRICT_DEL &&
pg_trigger->tgfoid != F_RI_FKEY_CASCADE_UPD &&
pg_trigger->tgfoid != F_RI_FKEY_CASCADE_DEL &&
pg_trigger->tgfoid != F_RI_FKEY_SETNULL_UPD &&
pg_trigger->tgfoid != F_RI_FKEY_SETNULL_DEL &&
pg_trigger->tgfoid != F_RI_FKEY_SETDEFAULT_UPD &&
pg_trigger->tgfoid != F_RI_FKEY_SETDEFAULT_DEL)
{
if (stmt->deferred && !pg_trigger->tgdeferrable)
ereport(ERROR,