From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Wrap appendrel member outputs in PlaceHolderVars in additional c |
Date: | 2011-11-09 02:14:46 |
Message-ID: | E1RNxgc-0002yE-LC@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Wrap appendrel member outputs in PlaceHolderVars in additional cases.
Add PlaceHolderVar wrappers as needed to make UNION ALL sub-select output
expressions appear non-constant and distinct from each other. This makes
the world safe for add_child_rel_equivalences to do what it does. Before,
it was possible for that function to add identical expressions to different
EquivalenceClasses, which logically should imply merging such ECs, which
would be wrong; or to improperly add a constant to an EquivalenceClass,
drastically changing its behavior. Per report from Teodor Sigaev.
The only currently known consequence of this bug is "MergeAppend child's
targetlist doesn't match MergeAppend" planner failures in 9.1 and later.
I am suspicious that there may be other failure modes that could affect
older release branches; but in the absence of any hard evidence, I'll
refrain from back-patching further than 9.1.
Branch
------
REL9_1_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/7097e6c4a48bc02155a9a52c570be67b30b30c9a
Modified Files
--------------
src/backend/optimizer/plan/planmain.c | 2 +-
src/backend/optimizer/prep/prepjointree.c | 38 +++++++++++++-----
src/backend/optimizer/util/placeholder.c | 27 ++++++++++---
src/include/optimizer/placeholder.h | 2 +-
src/test/regress/expected/inherit.out | 58 +++++++++++++++++++++++++++++
src/test/regress/sql/inherit.sql | 31 +++++++++++++++
6 files changed, 138 insertions(+), 20 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-11-09 04:05:32 | pgsql: Fix random discrepancies between parallel_schedule and serial_sc |
Previous Message | Heikki Linnakangas | 2011-11-08 20:51:45 | pgsql: Make DatumGetInetP() unpack inet datums with a 1-byte header, an |