mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Add a WHEN clause to CREATE TRIGGER, allowing a boolean expression to be
checked to determine whether the trigger should be fired. For BEFORE triggers this is mostly a matter of spec compliance; but for AFTER triggers it can provide a noticeable performance improvement, since queuing of a deferred trigger event and re-fetching of the row(s) at end of statement can be short-circuited if the trigger does not need to be fired. Takahiro Itagaki, reviewed by KaiGai Kohei.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.415 2009/11/16 21:32:07 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.416 2009/11/20 20:38:11 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1571,6 +1571,7 @@ typedef struct CreateTrigStmt
|
||||
/* events uses the TRIGGER_TYPE bits defined in catalog/pg_trigger.h */
|
||||
int16 events; /* INSERT/UPDATE/DELETE/TRUNCATE */
|
||||
List *columns; /* column names, or NIL for all columns */
|
||||
Node *whenClause; /* qual expression, or NULL if none */
|
||||
|
||||
/* The following are used for constraint triggers (RI and unique checks) */
|
||||
bool isconstraint; /* This is a constraint trigger */
|
||||
|
||||
Reference in New Issue
Block a user