Skip to content

case_when(TRUE ~ ...) should translate to ELSE ... for SQLite #754

@mgirlich

Description

@mgirlich

It is currently translated to WHEN (1) THEN ...

library(dbplyr)
translate_sql(
  case_when(
    x == 1L ~ "yes",
    x == 0L ~ "no",
    TRUE    ~ "undefined"
  ),
  con = simulate_sqlite()
)
#> <SQL> CASE
#> WHEN (`x` = 1) THEN ('yes')
#> WHEN (`x` = 0) THEN ('no')
#> WHEN (1) THEN ('undefined')
#> END

Created on 2022-01-14 by the reprex package (v2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions