summaryrefslogtreecommitdiff
path: root/src/backend/executor/README
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-02-27 13:43:29 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-02-27 13:44:12 -0500
commita874fe7b4c890d1fe3455215a83ca777867beadd (patch)
tree04b7870100a76bb79470abaf0f971550043590d7 /src/backend/executor/README
parent67a5e727c8655496013b007d2fb6137fcc244b18 (diff)
downloadpostgresql-a874fe7b4c890d1fe3455215a83ca777867beadd.tar.gz
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/executor/README')
-rw-r--r--src/backend/executor/README5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/executor/README b/src/backend/executor/README
index fec191d9b0..8afa1e3e4a 100644
--- a/src/backend/executor/README
+++ b/src/backend/executor/README
@@ -95,12 +95,17 @@ This is a sketch of control flow for full query processing:
CreateExprContext
creates per-tuple context
ExecInitExpr
+ AfterTriggerBeginQuery
ExecutorRun
ExecProcNode --- recursively called in per-query context
ExecEvalExpr --- called in per-tuple context
ResetExprContext --- to free memory
+ ExecutorFinish
+ ExecPostprocessPlan --- run any unfinished ModifyTable nodes
+ AfterTriggerEndQuery
+
ExecutorEnd
ExecEndNode --- recursively releases resources
FreeExecutorState