aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/trigger.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-10-21 21:33:59 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-10-21 21:33:59 +0000
commit12a47c6aca43e33d42ef946761ec0406476dd1b0 (patch)
treea66d775b8a16bbac21af385fc2a5bfb9a51aafe8 /src/backend/commands/trigger.c
parent7627b91cd5d9a35415ecb15a55ea46d6b481700c (diff)
downloadpostgresql-12a47c6aca43e33d42ef946761ec0406476dd1b0.tar.gz
postgresql-12a47c6aca43e33d42ef946761ec0406476dd1b0.zip
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.
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r--src/backend/commands/trigger.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 5480fce189f..7b1bdddf0ba 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -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,