summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/clausesel.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-09-09 02:36:04 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-09-09 02:36:04 +0000
commit51db6455eac8aa5b0078cefffed51a6257ccbe1d (patch)
treeb32ee35da610ebae0397bec58e0ad57143a21517 /src/backend/optimizer/path/clausesel.c
parent45500964f61b0ec671b84b1fdb988bad78f35473 (diff)
Repair error noticed by Roberto Cornacchia: selectivity code
was rejecting negative attnums as bogus, which of course they are not. Add code to get_attdisbursion to produce a useful value for OID attribute, since VACUUM does not store stats for system attributes. Also, repair bug that's been in eqjoinsel for a long time: it was taking the max of the two columns' disbursions, whereas it should use the min.
Diffstat (limited to 'src/backend/optimizer/path/clausesel.c')
-rw-r--r--src/backend/optimizer/path/clausesel.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index 23998a54bff..5264d508342 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.25 1999/07/25 23:07:24 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.26 1999/09/09 02:35:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -230,24 +230,24 @@ compute_clause_selec(Query *root, Node *clause)
int flag;
get_relattval(clause, 0, &relidx, &attno, &constval, &flag);
- if (relidx <= 0 || attno <= 0)
+ if (relidx && attno)
+ s1 = (Cost) restriction_selectivity(oprrest,
+ opno,
+ getrelid(relidx,
+ root->rtable),
+ attno,
+ constval,
+ flag);
+ else
{
/*
- * attno can be Invalid if the clause had a function in it,
+ * attno can be 0 if the clause had a function in it,
* i.e. WHERE myFunc(f) = 10
*
* XXX should be FIXED to use function selectivity
*/
s1 = (Cost) (0.5);
}
- else
- s1 = (Cost) restriction_selectivity(oprrest,
- opno,
- getrelid(relidx,
- root->rtable),
- attno,
- constval,
- flag);
}
}
else
@@ -274,7 +274,8 @@ compute_clause_selec(Query *root, Node *clause)
attno2;
get_rels_atts(clause, &relid1, &attno1, &relid2, &attno2);
- if (relid1 > 0 && relid2 > 0 && attno1 > 0 && attno2 > 0)
+ if (relid1 && relid2 && attno1 && attno2)
+
s1 = (Cost) join_selectivity(oprjoin,
opno,
getrelid(relid1,