aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-29 18:55:48 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-29 18:55:48 +0000
commit3276e911d154acd83c7ad5abeda11a4ab90866d3 (patch)
tree031afdbd52746051881618c896869edb9b9272cc /src
parent3edec383e1ad8c07dc3ecb9b98e8fb6197e9359e (diff)
downloadpostgresql-3276e911d154acd83c7ad5abeda11a4ab90866d3.tar.gz
postgresql-3276e911d154acd83c7ad5abeda11a4ab90866d3.zip
When building a bitmap scan, must copy the bitmapqualorig expression tree
to avoid sharing substructure with the lower-level indexquals. This is currently only an issue if there are SubPlans in the indexquals, which is uncommon but not impossible --- see bug #2218 reported by Nicholas Vinen. We use the same kluge for indexqual vs indexqualorig in the index scans themselves ... would be nice to clean this up someday.
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/createplan.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index e5355340c17..27b40999993 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.206 2006/01/25 20:29:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.207 2006/01/29 18:55:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -963,6 +963,12 @@ create_bitmap_scan_plan(PlannerInfo *root,
*/
bitmapqualorig = list_difference_ptr(bitmapqualorig, qpqual);
+ /*
+ * Copy the finished bitmapqualorig to make sure we have an independent
+ * copy --- needed in case there are subplans in the index quals
+ */
+ bitmapqualorig = copyObject(bitmapqualorig);
+
/* Finally ready to build the plan node */
scan_plan = make_bitmap_heapscan(tlist,
qpqual,