#6158·cube

Zero-option "case" dimensions compile but don't work

Author: igorlukaninCreated Feb 14, 2023Updated Sep 30, 2026

Describe the bug It is possible to create a dimension of the "case" type with no options in the "when" array and just the "else" statement. The data model would compile but the resulting SQL would be incorrect and wouldn't run.

To Reproduce Steps to reproduce the behavior:

  1. Add a dimension like this:
javascript
    area: {
      case: {
        when: [

        ],
        else: { label: `Unknown` }
      },
      type: `string`,
    },
  1. When querying, see it's compiled to the following:
sql
SELECT
  CASE
    ELSE 'Unknown'
  END `web_sessions__area`,
...
  1. See the error:
Syntax error: Unexpected keyword ELSE at [3:6]

Expected behavior I think that any of these two options would work:

  • a dimension like this is considered incorrect and wouldn't validate/compile
  • a dimension like this is considered correct and would compile to a correct SQL query (essentially becoming a string dimension)

Screenshots —

Minimally reproducible Cube Schema See above.

Version: 0.31.62