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

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.
This commit is contained in:
Tom Lane
2006-09-04 21:15:56 +00:00
parent 395c8166aa
commit f8bbfad075
3 changed files with 79 additions and 4 deletions

View File

@ -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 $
*
*-------------------------------------------------------------------------
*/
@ -611,6 +611,13 @@ ExecuteTruncate(TruncateStmt *stmt)
heap_truncate_check_FKs(rels, false);
#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.
*/