[ 
https://issues.apache.org/jira/browse/DERBY-6423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14165285#comment-14165285
 ] 

ASF subversion and git services commented on DERBY-6423:
--------------------------------------------------------

Commit 1630516 from [email protected] in branch 'code/branches/10.10'
[ https://svn.apache.org/r1630516 ]

DERBY-6423: The expression syntax in CASE's THEN clause doesn't accept boolean 
value expression

backported change #r1592465 from trunk to 10.10 branch.

Allow boolean value expressions in CASE and NULLIF expressions.

> The expression syntax in CASE's THEN clause doesn't accept boolean value 
> expression
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-6423
>                 URL: https://issues.apache.org/jira/browse/DERBY-6423
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>            Reporter: Dag H. Wanvik
>            Assignee: Mike Matrigali
>             Fix For: 10.11.1.1
>
>         Attachments: d6423-1a.diff
>
>
> This syntax gives an error:
> {noformat}
> > VALUES CASE WHEN 1=1 THEN (1=2) OR (3!=4) ELSE true END;
> ERROR 42X01: Syntax error: Encountered "OR" at line 1, column 33.
> {noformat}
> However, this works:
> {noformat}
> > VALUES CASE WHEN 1=1 THEN ((1=2) OR (3!=4)) ELSE true END;
> 1    
> -----
> true 
> 1 row selected
> {noformat}
> According to the standard, the syntax after THEN should be <result>:
> {noformat}
> <result> ::=
>    <result expression>
>    | NULL
> <result expression> ::=
>    <value expression>
> {noformat}
> which should give us the full value syntax. sqlgrammar.jj uses the 
> corresponding production "thenElseExpression" which allows NULL or 
> aditiveExpression. I believe it should be orExpression.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to