[
https://issues.apache.org/jira/browse/DERBY-4583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875616#action_12875616
]
Rick Hillegas commented on DERBY-4583:
--------------------------------------
Hi Knut,
I have looked at your question again and I see that the second query does not
involve BOOLEANs at all. I have looked at the SQL Standard again and I think
that you are right, the UNION between a character type and a boolean type
should not work at all and can be rejected at compile-time. That is, Derby
should not be performing implicit casts in the query mentioned in DERBY-4684.
This is my reasoning:
1) The rules for determining whether two datatypes are union compatible are
stated in the SQL Standard in part 2, section 7.3 (<query expression>), syntax
rule 20.b.ii.
2) That, in turn, refers the reader to section 9.3 (Result of data type
combinations).
3) Section 9.3, syntax rule 3.g says that if either of two values to be merged
is BOOLEAN, then both must be BOOLEAN.
> TRUE by itself is not accepted in WHERE
> ---------------------------------------
>
> Key: DERBY-4583
> URL: https://issues.apache.org/jira/browse/DERBY-4583
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.3.0
> Environment: n/a
> Reporter: Wouter
> Assignee: Rick Hillegas
> Attachments: derby-4583-01-ac-booleanLiterals.diff
>
>
> A SELECT query with a literal boolean value in its WHERE clause results in a
> syntax error.
> How to reproduce:
> CREATE TABLE list (value VARCHAR(10));
> Given this table, the following queries result in a syntax error.
> SELECT * FROM list WHERE TRUE;
> SELECT * FROM list WHERE FALSE;
> SELECT * FROM list WHERE value='A' OR TRUE;
> Why is TRUE/FALSE not a boolean expression?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.