summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/indxpath.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-01-29 17:27:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-01-29 17:27:42 +0000
commita1b7e70c5fbcb52ee5fb16ef567365a978c6fea7 (patch)
tree20091165257468f28e42ca107a094b8307da0a78 /src/backend/optimizer/path/indxpath.c
parent4400ca2bada53fedda1c6ac10b3eaacb82e1b33b (diff)
Fix code that checks to see if an index can be considered to match the query's
requested sort order. It was assuming that build_index_pathkeys always generates a pathkey per index column, which was not true if implied equality deduction had determined that two index columns were effectively equated to each other. Simplest fix seems to be to install an option that causes build_index_pathkeys to support this behavior as well as the original one. Per report from Brian Hirt.
Diffstat (limited to 'src/backend/optimizer/path/indxpath.c')
-rw-r--r--src/backend/optimizer/path/indxpath.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index a00ad764c71..4eea16a0183 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.198 2006/01/26 02:35:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.199 2006/01/29 17:27:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -343,7 +343,8 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
if (istoplevel && index_is_ordered && !isjoininner)
{
index_pathkeys = build_index_pathkeys(root, index,
- ForwardScanDirection);
+ ForwardScanDirection,
+ true);
useful_pathkeys = truncate_useless_pathkeys(root, rel,
index_pathkeys);
}
@@ -1705,7 +1706,7 @@ match_index_to_query_keys(PlannerInfo *root,
ListCell *r;
/* Get the pathkeys that exactly describe the index */
- index_pathkeys = build_index_pathkeys(root, index, indexscandir);
+ index_pathkeys = build_index_pathkeys(root, index, indexscandir, false);
/*
* Can we match to the query's requested pathkeys? The inner loop skips