Skip site navigation (1) Skip section navigation (2)

pgsql: Fix PlanRowMark/ExecRowMark structures to handle inheritancecor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix PlanRowMark/ExecRowMark structures to handle inheritancecor
Date: 2011-01-13 01:48:47
Message-ID: E1PdCIx-0005Dn-0d@gemulon.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Fix PlanRowMark/ExecRowMark structures to handle inheritance correctly.

In an inherited UPDATE/DELETE, each target table has its own subplan,
because it might have a column set different from other targets.  This
means that the resjunk columns we add to support EvalPlanQual might be
at different physical column numbers in each subplan.  The EvalPlanQual
rewrite I did for 9.0 failed to account for this, resulting in possible
misbehavior or even crashes during concurrent updates to the same row,
as seen in a recent report from Gordon Shannon.  Revise the data structure
so that we track resjunk column numbers separately for each subplan.

I also chose to move responsibility for identifying the physical column
numbers back to executor startup, instead of assuming that numbers derived
during preprocess_targetlist would stay valid throughout subsequent
massaging of the plan.  That's a bit slower, so we might want to consider
undoing it someday; but it would complicate the patch considerably and
didn't seem justifiable in a bug fix that has to be back-patched to 9.0.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=fed8dcdb84d255088d22efa3156a193f3399e792

Modified Files
--------------
src/backend/executor/execJunk.c        |   14 ++++-
src/backend/executor/execMain.c        |  107 ++++++++++++++++++++++++--------
src/backend/executor/nodeLockRows.c    |   51 ++++++++--------
src/backend/executor/nodeModifyTable.c |   42 +++++++------
src/backend/nodes/copyfuncs.c          |    3 -
src/backend/nodes/outfuncs.c           |    3 -
src/backend/optimizer/plan/planner.c   |    8 ---
src/backend/optimizer/prep/preptlist.c |   17 +-----
src/backend/optimizer/prep/prepunion.c |    4 -
src/include/executor/executor.h        |   10 ++-
src/include/nodes/execnodes.h          |   34 ++++++++---
src/include/nodes/plannodes.h          |   21 +++++--
12 files changed, 192 insertions(+), 122 deletions(-)

pgsql-committers by date

Next:From: Bruce MomjianDate: 2011-01-13 01:50:25
Subject: pgsql: Apply libpq documentation patches submitted by Leslie SSatenste
Previous:From: Tom LaneDate: 2011-01-13 01:48:46
Subject: pgsql: Fix PlanRowMark/ExecRowMark structures to handle inheritancecor

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group