summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kreen2010-09-06 13:12:18 +0000
committerMarko Kreen2010-09-06 13:14:53 +0000
commitda8603cd065970a25b0187adbf9573111f4d17a0 (patch)
tree453a27c60d8304cba61e275becc6467d2f3afc99
parent444643474f584086bef847f60e83bd63317289b2 (diff)
pgq/triggers: throw error if SKIP if used in AFTER trigger.
-rw-r--r--sql/pgq/triggers/common.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/pgq/triggers/common.c b/sql/pgq/triggers/common.c
index f43efad7..ccfa45e6 100644
--- a/sql/pgq/triggers/common.c
+++ b/sql/pgq/triggers/common.c
@@ -477,8 +477,6 @@ void pgq_prepare_event(struct PgqTriggerEvent *ev, TriggerData *tg, bool newstyl
/*
* Check trigger calling conventions
*/
- if (!TRIGGER_FIRED_AFTER(tg->tg_event))
- /* dont care */ ;
if (TRIGGER_FIRED_BY_TRUNCATE(tg->tg_event)) {
if (!TRIGGER_FIRED_FOR_STATEMENT(tg->tg_event))
elog(ERROR, "pgq tRuncate trigger must be fired FOR EACH STATEMENT");
@@ -531,6 +529,17 @@ void pgq_prepare_event(struct PgqTriggerEvent *ev, TriggerData *tg, bool newstyl
ev->tgargs->finalized = true;
/*
+ * Check if BEFORE/AFTER makes sense.
+ */
+ if (ev->tgargs->skip) {
+ if (TRIGGER_FIRED_AFTER(tg->tg_event))
+ elog(ERROR, "SKIP does not work in AFTER trigger.");
+ } else {
+ if (!TRIGGER_FIRED_AFTER(tg->tg_event))
+ /* dont care ??? */ ;
+ }
+
+ /*
* init data
*/
ev->field[EV_TYPE] = pgq_init_varbuf();