Attaching derby-4720-01-ac-allowBooleanExpressions.diff. This patch makes it possible to use boolean-valued expressions in several situations required by the SQL Standard. The tests ran cleanly for me.
The grammar was changed as follows:
1) The inSelectClause arguments were rototilled out of productions which return ValueNode. Those arguments were added when the BOOLEAN datatype was disabled. Their purpose was to reject BOOLEAN-valued expressions in the situations listed in (2) below. This rototill accounts for most of the changes to the parser.
2) Calls to additiveExpression() were replaced by calls to orExpression() in the following productions. This allows unparenthesized boolean expressions to appear in SELECT lists, as columns in VALUES constructors, as arguments to FUNCTIONs and PROCEDUREs, and as targets of SET clauses. The Derby productions do not map exactly to the productions in the SQL grammar. The orExpression() production lies above additiveExpression() in Derby's grammar. That is, it is more general. It is possible that an even more general production might bring us even closer to the SQL Standard. However, orExpression() seemed to me to be the minimal production required to allow unparenthesized boolean-valued expressions. Generalizing this further seems to me to be beyond the scope of this JIRA.
i) derivedColumn() (SELECT list)
ii) rowValueConstructor() (VALUES clause)
iii) methodParameter() (routine arguments)
iv) updateSource() (SET clauses)
Touches the following files:
Grammar changes described above.
New test case. More extensive testing is provided by the revised tests below.
Changes to existing tests to account for the fact that boolean expressions can now appear in other situations required by the SQL Standard.