aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-09-04 21:15:56 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-09-04 21:15:56 +0000
commitf8bbfad075e855d4603e44847cd6ec51c91b3f92 (patch)
treeb66bfc92f3e6eb5c6a0105ca95f4d0f216e3a619 /src/backend/commands/tablecmds.c
parent395c8166aa02326e46d70bb60537348a84843fd8 (diff)
downloadpostgresql-f8bbfad075e855d4603e44847cd6ec51c91b3f92.tar.gz
postgresql-f8bbfad075e855d4603e44847cd6ec51c91b3f92.zip
Disallow TRUNCATE when there are any pending after-trigger events for
the target relation(s). There might be some cases where we could discard the pending event instead, but for the moment a conservative approach seems sufficient. Per report from Markus Schiltknecht and subsequent discussion.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 7e8884496d0..45167b816af 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.201 2006/08/25 04:06:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.202 2006/09/04 21:15:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -612,6 +612,13 @@ ExecuteTruncate(TruncateStmt *stmt)
#endif
/*
+ * Also check for pending AFTER trigger events on the target relations.
+ * We can't just leave those be, since they will try to fetch tuples
+ * that the TRUNCATE removes.
+ */
+ AfterTriggerCheckTruncate(relids);
+
+ /*
* OK, truncate each table.
*/
foreach(cell, rels)