Trivial form of CASE is not supported in DERBY Parser

Bug #1205056 reported by Ori Herrnstadt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Akiban SQL Parser
Fix Released
Low
Mike McMahon

Bug Description

The following query syntax fails:

SELECT c,
       d-e,
       CASE a+1 WHEN b THEN 111 WHEN c THEN 222
        WHEN d THEN 333 WHEN e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       e
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
 ORDER BY 1,5,3,2,4

With the following error:

ERROR: Encountered " <IDENTIFIER> "a "" at line 3, column 13.
Was expecting:
    "when" ...

LINE 3: CASE a+1 WHEN b THEN 111 WHEN c THEN 222
                    ^

When the CASE comparison expression is re-written as 'a+1 = x' it passes:

SELECT c,
       d-e,
       CASE WHEN a+1 = b THEN 111 WHEN a+1 = c THEN 222
        WHEN a+1 = d THEN 333 WHEN a+1 = e THEN 444 ELSE 555 END,
       a+b*2+c*3+d*4,
       e
  FROM t1
 WHERE d NOT BETWEEN 110 AND 150
    OR c BETWEEN b-2 AND d+2
    OR (e>c OR e<d)
 ORDER BY 1,5,3,2,4

See also Derby thread from 2011: http://apache-database.10148.n7.nabble.com/CASE-expression-WHEN-expression-THEN-expression-END-syntax-td101242.html

Tags: parser

Related branches

Revision history for this message
Mike McMahon (mmcm) wrote :

Or http://db.apache.org/derby/docs/10.0/manuals/reference/sqlj151.html. The simple form is not supported, only the searched form.

information type: Proprietary → Public
affects: akiban-server → akiban-sql-parser
Ori Herrnstadt (ori-)
description: updated
Changed in akiban-sql-parser:
status: New → Fix Committed
assignee: nobody → Mike McMahon (mmcm)
milestone: none → 1.0.16
Changed in akiban-sql-parser:
status: Fix Committed → Won't Fix
status: Won't Fix → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.