diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-02-27 13:43:29 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-02-27 13:44:12 -0500 |
commit | a874fe7b4c890d1fe3455215a83ca777867beadd (patch) | |
tree | 04b7870100a76bb79470abaf0f971550043590d7 /src/backend/commands/trigger.c | |
parent | 67a5e727c8655496013b007d2fb6137fcc244b18 (diff) | |
download | postgresql-a874fe7b4c890d1fe3455215a83ca777867beadd.tar.gz postgresql-a874fe7b4c890d1fe3455215a83ca777867beadd.zip |
Refactor the executor's API to support data-modifying CTEs better.
The originally committed patch for modifying CTEs didn't interact well
with EXPLAIN, as noted by myself, and also had corner-case problems with
triggers, as noted by Dean Rasheed. Those problems show it is really not
practical for ExecutorEnd to call any user-defined code; so split the
cleanup duties out into a new function ExecutorFinish, which must be called
between the last ExecutorRun call and ExecutorEnd. Some Asserts have been
added to these functions to help verify correct usage.
It is no longer necessary for callers of the executor to call
AfterTriggerBeginQuery/AfterTriggerEndQuery for themselves, as this is now
done by ExecutorStart/ExecutorFinish respectively. If you really need to
suppress that and do it for yourself, pass EXEC_FLAG_SKIP_TRIGGERS to
ExecutorStart.
Also, refactor portal commit processing to allow for the possibility that
PortalDrop will invoke user-defined code. I think this is not actually
necessary just yet, since the portal-execution-strategy logic forces any
non-pure-SELECT query to be run to completion before we will consider
committing. But it seems like good future-proofing.
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index dc6ee9c266f..0af8a11b0a7 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -3676,9 +3676,9 @@ AfterTriggerBeginQuery(void) * we invoke all AFTER IMMEDIATE trigger events queued by the query, and * transfer deferred trigger events to the global deferred-trigger list. * - * Note that this should be called just BEFORE closing down the executor + * Note that this must be called BEFORE closing down the executor * with ExecutorEnd, because we make use of the EState's info about - * target relations. + * target relations. Normally it is called from ExecutorFinish. * ---------- */ void |