Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6423

The expression syntax in CASE's THEN clause doesn't accept boolean value expression

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 10.10.2.1, 10.11.1.1
    • SQL
    • None
    • Repro attached

    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.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            knutanders Knut Anders Hatlen
            dagw Dag H. Wanvik
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment