aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/allpaths.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-05-02 04:34:24 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-05-02 04:34:24 +0000
commita3fe5ed59451f31f309bd06624e9644170fc604c (patch)
tree34dc5cb569761d9e1c1fb5fd0457c44c8f198025 /src/backend/optimizer/path/allpaths.c
parent0619268b4ba85bc5578aa960473a5a77dce12a17 (diff)
downloadpostgresql-a3fe5ed59451f31f309bd06624e9644170fc604c.tar.gz
postgresql-a3fe5ed59451f31f309bd06624e9644170fc604c.zip
Avoid assuming that statistics for a parent relation reflect the properties of
the union of its child relations as well. This might have been a good idea when it was originally coded, but it's a fatally bad idea when inheritance is being used for partitioning. It's better to have no stats at all than completely misleading stats. Per report from Mark Liberman. The bug arguably exists all the way back, but I've only patched HEAD and 8.1 because we weren't particularly trying to support partitioning before 8.1. Eventually we ought to look at deriving union statistics instead of just punting, but for now the drop kick looks good.
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r--src/backend/optimizer/path/allpaths.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index f665c3f1dc5..d1137c80c91 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.137.2.2 2006/02/13 16:22:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.137.2.3 2006/05/02 04:34:24 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -264,6 +264,13 @@ set_inherited_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
errmsg("SELECT FOR UPDATE/SHARE is not supported for inheritance queries")));
/*
+ * We might have looked up indexes for the parent rel, but they're
+ * really not relevant to the appendrel. Reset the pointer to avoid
+ * any confusion.
+ */
+ rel->indexlist = NIL;
+
+ /*
* Initialize to compute size estimates for whole inheritance tree
*/
rel->rows = 0;