summaryrefslogtreecommitdiff
path: root/src/include/optimizer/paths.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-01-15 14:09:35 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2017-01-15 14:09:35 -0500
commit0777f7a2e8e0a51f0f60cfe164d538bb459bf9f2 (patch)
tree8fb8890cc978833ede6572949b5558b125e2361f /src/include/optimizer/paths.h
parent83f2061dd037477ec8479ee160367840e203a722 (diff)
Fix matching of boolean index columns to sort ordering.
Normally, if we have a WHERE clause like "indexcol = constant", the planner will figure out that that index column can be ignored when determining whether the index has a desired sort ordering. But this failed to work for boolean index columns, because a condition like "boolcol = true" is canonicalized to just "boolcol" which does not give rise to an EquivalenceClass. Add a check to allow the same type of deduction to be made in this case too. Per a complaint from Dima Pavlov. Arguably this is a bug, but given the limited impact and the small number of complaints so far, I won't risk destabilizing plans in stable branches by back-patching. Patch by me, reviewed by Michael Paquier Discussion: https://postgr.es/m/1788.1481605684@sss.pgh.pa.us
Diffstat (limited to 'src/include/optimizer/paths.h')
-rw-r--r--src/include/optimizer/paths.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 480f25f942b..81a9be7c674 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -66,6 +66,8 @@ extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel);
extern bool relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel,
List *restrictlist,
List *exprlist, List *oprlist);
+extern bool indexcol_is_bool_constant_for_query(IndexOptInfo *index,
+ int indexcol);
extern bool match_index_to_operand(Node *operand, int indexcol,
IndexOptInfo *index);
extern void expand_indexqual_conditions(IndexOptInfo *index,