diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-28 21:57:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-28 21:57:37 +0000 |
commit | c607bd693ffcf225b7ef696ca44b537076038854 (patch) | |
tree | 5284d0d0f9b8d671dedd379199bdbba114f8a352 /src/backend/utils/adt/selfuncs.c | |
parent | d167fb10153a2f00c9a8b46df537a202f7755cb9 (diff) | |
download | postgresql-c607bd693ffcf225b7ef696ca44b537076038854.tar.gz postgresql-c607bd693ffcf225b7ef696ca44b537076038854.zip |
Clean up the usage of canonicalize_qual(): in particular, be consistent
about whether it is applied before or after eval_const_expressions().
I believe there were some corner cases where the system would fail to
recognize that a partial index is applicable because of the previous
inconsistency. Store normal rather than 'implicit AND' representations
of constraints and index predicates in the catalogs.
initdb forced due to representation change of constraints/predicates.
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r-- | src/backend/utils/adt/selfuncs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 9b2e86224a5..0a37df1d9a7 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.150 2003/12/07 04:14:10 joe Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.151 2003/12/28 21:57:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3902,12 +3902,12 @@ genericcostestimate(Query *root, RelOptInfo *rel, * If the index is partial, AND the index predicate with the * explicitly given indexquals to produce a more accurate idea of the * index restriction. This may produce redundant clauses, which we - * hope that cnfify and clauselist_selectivity will deal with + * hope that canonicalize_qual and clauselist_selectivity will deal with * intelligently. * * Note that index->indpred and indexQuals are both in implicit-AND form * to start with, which we have to make explicit to hand to - * canonicalize_qual, and then we get back implicit-AND form again. + * canonicalize_qual, and then we convert back to implicit-AND form. */ if (index->indpred != NIL) { @@ -3915,7 +3915,8 @@ genericcostestimate(Query *root, RelOptInfo *rel, andedQuals = make_ands_explicit(nconc(listCopy(index->indpred), indexQuals)); - selectivityQuals = canonicalize_qual(andedQuals, true); + andedQuals = canonicalize_qual(andedQuals); + selectivityQuals = make_ands_implicit(andedQuals); } /* Estimate the fraction of main-table tuples that will be visited */ |