| From: | tgl(at)postgresql(dot)org (Tom Lane) |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Allow predicate_refuted_by() to deduce that NOT A refutes A. |
| Date: | 2010-02-25 21:00:15 |
| Message-ID: | 20100225210015.930447541D1@cvs.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Log Message:
-----------
Allow predicate_refuted_by() to deduce that NOT A refutes A.
We had originally made the stronger assumption that NOT A refutes any B
if B implies A, but this fails in three-valued logic, because we need to
prove B is false not just that it's not true. However the logic does
go through if B is equal to A.
Recognizing this limited case is enough to handle examples that arise when
we have simplified "bool_var = true" or "bool_var = false" to just "bool_var"
or "NOT bool_var". If we had not done that simplification then the
btree-operator proof logic would have been able to prove that the expressions
were contradictory, but only for identical expressions being compared to the
constants; so handling identical A and B covers all the same cases.
The motivation for doing this is to avoid unexpected asymmetrical behavior
when a partitioned table uses a boolean partitioning column, as in today's
gripe from Dominik Sander.
Back-patch to 8.2, which is as far back as predicate_refuted_by attempts to
do anything at all with NOTs.
Tags:
----
REL8_2_STABLE
Modified Files:
--------------
pgsql/src/backend/optimizer/util:
predtest.c (r1.10.2.5 -> r1.10.2.6)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/predtest.c?r1=1.10.2.5&r2=1.10.2.6)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2010-02-25 22:24:00 | pgsql: Document that after triggers that need to see changed rows should |
| Previous Message | Tom Lane | 2010-02-25 21:00:10 | pgsql: Allow predicate_refuted_by() to deduce that NOT A refutes A. |