Skip to content

Reduce "useless" CASE expressions #5571

@gianm

Description

@gianm

In general CASE WHEN X THEN true ELSE false END could just be reduced to X. For example, a query seen in the wild contained:

((CASE WHEN (( generic.__time ) >= (TIME_PARSE('2018-03-08 00:00:00.000', 'yyyy-MM-dd HH:mm:ss.SSS')) AND ( generic.__time ) < (TIME_PARSE('2018-03-09 00:00:00.000', 'yyyy-MM-dd HH:mm:ss.SSS'))) THEN true ELSE false END))

Metadata

Metadata

Assignees

No one assigned

    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