From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix matching of boolean index columns to sort ordering. |
Date: | 2017-01-15 19:09:45 |
Message-ID: | E1cSqBV-000147-7d@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/0777f7a2e8e0a51f0f60cfe164d538bb459bf9f2
Modified Files
--------------
src/backend/optimizer/path/indxpath.c | 46 ++++++++++++++++++++++++++++++
src/backend/optimizer/path/pathkeys.c | 35 ++++++++++++++++-------
src/include/optimizer/paths.h | 2 ++
src/test/regress/expected/create_index.out | 42 +++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql | 15 ++++++++++
5 files changed, 129 insertions(+), 11 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2017-01-16 06:04:38 | Re: [COMMITTERS] pgsql: Fix a bug in how we generate partition constraints. |
Previous Message | Tom Lane | 2017-01-14 21:17:41 | pgsql: Teach contrib/pg_stat_statements to handle multi-statement comma |