mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Support UPDATE/DELETE WHERE CURRENT OF cursor_name, per SQL standard.
Along the way, allow FOR UPDATE in non-WITH-HOLD cursors; there may once have been a reason to disallow that, but it seems to work now, and it's really rather necessary if you want to select a row via a cursor and then update it in a concurrent-safe fashion. Original patch by Arul Shaji, rather heavily editorialized by Tom Lane.
This commit is contained in:
doc/src/sgml/ref
src
backend
executor
nodes
optimizer
parser
rewrite
utils
adt
include
test
regress
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.294 2007/06/03 17:07:00 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.295 2007/06/11 01:16:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2368,6 +2368,24 @@ EvalPlanQualStop(evalPlanQual *epq)
|
||||
epq->planstate = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ExecGetActivePlanTree --- get the active PlanState tree from a QueryDesc
|
||||
*
|
||||
* Ordinarily this is just the one mentioned in the QueryDesc, but if we
|
||||
* are looking at a row returned by the EvalPlanQual machinery, we need
|
||||
* to look at the subsidiary state instead.
|
||||
*/
|
||||
PlanState *
|
||||
ExecGetActivePlanTree(QueryDesc *queryDesc)
|
||||
{
|
||||
EState *estate = queryDesc->estate;
|
||||
|
||||
if (estate && estate->es_useEvalPlan && estate->es_evalPlanQual != NULL)
|
||||
return estate->es_evalPlanQual->planstate;
|
||||
else
|
||||
return queryDesc->planstate;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Support for SELECT INTO (a/k/a CREATE TABLE AS)
|
||||
|
Reference in New Issue
Block a user