forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3f8c23c
committed
Improve predtest.c's ability to reason about operator expressions.
We have for a long time been able to prove implications and refutationsbetween clauses structured like "expr op const" with the same subexpressionand btree-related operators; for example that "x < 4" implies "x <= 5".The implication machinery is needed to detect usability of partial indexes,and the refutation machinery is needed to implement constraint exclusion.This patch extends that machinery to make proofs for operator expressionsinvolving the same two immutable-but-not-necessarily-just-Const inputexpressions, ie does "expr1 op1 expr2" prove or refute "expr1 op2 expr2" or"expr2 op2 expr1"? An important example is that we can now prove "x = y"given "y = x", which formerly the code could not deduce unless x or y was aconstant. We can make use of the system's knowledge of operator commutatorand negator pairs, and can also make use of btree opclass relationships,for example "x < y" implies "x <= y" and refutes "x > y" (notice thatneither of these could be proven just from commutator or negator links).Inspired by a gripe from Brian Dunavant. This seems more like a newfeature than a bug fix, though, so no back-patch.1 parentc81e63d commit3f8c23c
1 file changed
+358
-159
lines changed0 commit comments
Comments
(0)