diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-12 18:10:51 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-12 18:10:51 +0000 |
| commit | 0adaf4cb312fe3eff83e786d6a0b53ae2cdc9302 (patch) | |
| tree | 177cf2ea668d6fcabbafc37db4741813ea3f685d /src/include/nodes/relation.h | |
| parent | 05d249717d652f0b16960d8a58611e222f1f907b (diff) | |
Move the handling of SELECT FOR UPDATE locking and rechecking out of
execMain.c and into a new plan node type LockRows. Like the recent change
to put table updating into a ModifyTable plan node, this increases planning
flexibility by allowing the operations to occur below the top level of the
plan tree. It's necessary in any case to restore the previous behavior of
having FOR UPDATE locking occur before ModifyTable does.
This partially refactors EvalPlanQual to allow multiple rows-under-test
to be inserted into the EPQ machinery before starting an EPQ test query.
That isn't sufficient to fix EPQ's general bogosity in the face of plans
that return multiple rows per test row, though. Since this patch is
mostly about getting some plan node infrastructure in place and not about
fixing ten-year-old bugs, I will leave EPQ improvements for another day.
Another behavioral change that we could now think about is doing FOR UPDATE
before LIMIT, but that too seems like it should be treated as a followon
patch.
Diffstat (limited to 'src/include/nodes/relation.h')
| -rw-r--r-- | src/include/nodes/relation.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 5e504b0ab4b..8edb58727c0 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,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/relation.h,v 1.176 2009/10/10 01:43:50 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.177 2009/10/12 18:10:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -68,16 +68,22 @@ typedef struct PlannerGlobal List *subrtables; /* Rangetables for SubPlan nodes */ + List *subrowmarks; /* RowMarkClauses for SubPlan nodes */ + Bitmapset *rewindPlanIDs; /* indices of subplans that require REWIND */ List *finalrtable; /* "flat" rangetable for executor */ + List *finalrowmarks; /* "flat" list of RowMarkClauses */ + List *relationOids; /* OIDs of relations the plan depends on */ List *invalItems; /* other dependencies, as PlanInvalItems */ Index lastPHId; /* highest PlaceHolderVar ID assigned */ + Index lastRowmarkId; /* highest RowMarkClause ID assigned */ + bool transientPlan; /* redo plan when TransactionXmin changes? */ } PlannerGlobal; @@ -281,6 +287,7 @@ typedef struct PlannerInfo * tuples - number of tuples in relation (not considering restrictions) * subplan - plan for subquery (NULL if it's not a subquery) * subrtable - rangetable for subquery (NIL if it's not a subquery) + * subrowmark - rowmarks for subquery (NIL if it's not a subquery) * * Note: for a subquery, tuples and subplan are not set immediately * upon creation of the RelOptInfo object; they are filled in when @@ -364,6 +371,7 @@ typedef struct RelOptInfo double tuples; struct Plan *subplan; /* if subquery */ List *subrtable; /* if subquery */ + List *subrowmark; /* if subquery */ /* used by various scans and joins: */ List *baserestrictinfo; /* RestrictInfo structures (if base |
