aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-10-11 16:45:00 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-10-11 16:45:00 +0000
commitd30c13480688185f261b373d5188043e7b8c00db (patch)
treeffa3df674cc8e940fa2709c1ef9c4a62d8a3373a /src
parent20f5a328e5a81e175d8dc864713b8c266d26a210 (diff)
downloadpostgresql-d30c13480688185f261b373d5188043e7b8c00db.tar.gz
postgresql-d30c13480688185f261b373d5188043e7b8c00db.zip
Fix oversight in 8.0 modification of RestrictInfo data structures.
A RestrictInfo representing an OR clause now contains two versions of the contained expression, one with sub-RestrictInfos and one without. clause_selectivity() should descend to the version with sub-RestrictInfos so that it has a chance of caching its results for the OR's sub-clauses. Failing to do so resulted in redundant planner effort.
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/path/clausesel.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index 580a386d3d8..5fe7fa5d2e6 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.72 2004/12/31 22:00:04 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.72.4.1 2005/10/11 16:45:00 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -461,8 +461,15 @@ clause_selectivity(Query *root,
}
}
- /* Proceed with examination of contained clause */
- clause = (Node *) rinfo->clause;
+ /*
+ * Proceed with examination of contained clause. If the clause is an
+ * OR-clause, we want to look at the variant with sub-RestrictInfos,
+ * so that per-subclause selectivities can be cached.
+ */
+ if (rinfo->orclause)
+ clause = (Node *) rinfo->orclause;
+ else
+ clause = (Node *) rinfo->clause;
}
if (IsA(clause, Var))