Description
FromVTI.makeRestriction() has this code to strip away Boolean constants from AND and OR expressions:
// strip off trailing vacuous constant if present
if ( andOperator.getRightOperand() instanceof BooleanConstantNode )
and
// strip off trailing vacuous constant if present
if ( orOperator.getRightOperand() instanceof BooleanConstantNode )
The code for AND will only work as expected if the right operand is TRUE. The code for OR only works correctly if the right operand is FALSE.
I'm not sure if this can ever result in user-visible bugs, since Boolean constants are usually removed before we get to this point in the code. The predicate has probably been transformed to conjunctive normal form, in which Boolean constants in the right operand of an AndNode or an OrNode in fact is always TRUE or FALSE, respectively.
I think this code either should be changed to work regardless of the value of the constant in the right operand, or the assumption that the predicate is on conjunctive normal form should be documented in the comments (and perhaps also checked in an assert statement).
Attachments
Attachments
Issue Links
- relates to
-
DERBY-4583 TRUE by itself is not accepted in WHERE
- Closed