diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-12-23 18:44:21 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-12-23 18:45:14 -0500 |
commit | e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195 (patch) | |
tree | 74e55d13a15a61c16946a0d720e8465aba36d864 /src/backend/optimizer/util/restrictinfo.c | |
parent | d5448c7d31b5af66a809e6580bae9bd31448bfa7 (diff) | |
download | postgresql-e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195.tar.gz postgresql-e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195.zip |
Improve planner's handling of duplicated index column expressions.
It's potentially useful for an index to repeat the same indexable column
or expression in multiple index columns, if the columns have different
opclasses. (If they share opclasses too, the duplicate column is pretty
useless, but nonetheless we've allowed such cases since 9.0.) However,
the planner failed to cope with this, because createplan.c was relying on
simple equal() matching to figure out which index column each index qual
is intended for. We do have that information available upstream in
indxpath.c, though, so the fix is to not flatten the multi-level indexquals
list when putting it into an IndexPath. Then we can rely on the sublist
structure to identify target index columns in createplan.c. There's a
similar issue for index ORDER BYs (the KNNGIST feature), so introduce a
multi-level-list representation for that too. This adds a bit more
representational overhead, but we might more or less buy that back by not
having to search for matching index columns anymore in createplan.c;
likewise btcostestimate saves some cycles.
Per bug #6351 from Christian Rudolph. Likely symptoms include the "btree
index keys must be ordered by attribute" failure shown there, as well as
"operator MMMM is not a member of opfamily NNNN".
Although this is a pre-existing problem that can be demonstrated in 9.0 and
9.1, I'm not going to back-patch it, because the API changes in the planner
seem likely to break things such as index plugins. The corner cases where
this matters seem too narrow to justify possibly breaking things in a minor
release.
Diffstat (limited to 'src/backend/optimizer/util/restrictinfo.c')
-rw-r--r-- | src/backend/optimizer/util/restrictinfo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index 63ff431900e..8e3d4bb8453 100644 --- a/src/backend/optimizer/util/restrictinfo.c +++ b/src/backend/optimizer/util/restrictinfo.c @@ -630,7 +630,7 @@ extract_actual_join_clauses(List *restrictinfo_list, * being used in an inner indexscan need not be checked again at the join. * * "Redundant" means either equal() or derived from the same EquivalenceClass. - * We have to check the latter because indxqual.c may select different derived + * We have to check the latter because indxpath.c may select different derived * clauses than were selected by generate_join_implied_equalities(). * * Note that we are *not* checking for local redundancies within the given |