db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6423) The expression syntax in CASE's THEN clause doesn't accept boolean value expression
Date Wed, 27 Nov 2013 14:57:36 GMT

     [ https://issues.apache.org/jira/browse/DERBY-6423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Dag H. Wanvik updated DERBY-6423:
---------------------------------

    Description: 
This syntax gives an error:

    > 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.

However, this works:

    > VALUES CASE WHEN 1=1 THEN ((1=2) OR (3!=4)) ELSE true END;
    1    
    -----
    true 
    1 row selected

According to the standard, the syntax after THEN should be <result>:

<result> ::=
   <result expression>
   | NULL

<result expression> ::=
   <value expression>

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.


  was:
This syntax gives an error:

> 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.

However, this works:

> VALUES CASE WHEN 1=1 THEN ((1=2) OR (3!=4)) ELSE true END;

According to the standard, the syntax after THEN should be <result>:

<result> ::=
   <result expression>
   | NULL

<result expression> ::=
   <value expression>

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.



> 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
>
> This syntax gives an error:
>     > 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.
> However, this works:
>     > VALUES CASE WHEN 1=1 THEN ((1=2) OR (3!=4)) ELSE true END;
>     1    
>     -----
>     true 
>     1 row selected
> According to the standard, the syntax after THEN should be <result>:
> <result> ::=
>    <result expression>
>    | NULL
> <result expression> ::=
>    <value expression>
> 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.1#6144)

Mime
View raw message