Skip to content

sql: FILTER applied after evaluating aggregate function expression #45845

@andy-kimball

Description

@andy-kimball

Repro:

root@:26257/defaultdb> SELECT SUM(1/x) FILTER (WHERE x > 0) FROM (VALUES (0), (1)) t(x);
ERROR: division by zero

EXPECTED: No error, like PG:

template1=# SELECT SUM(1/x) FILTER (WHERE x > 0) FROM (VALUES (0), (1)) t(x);
 sum
-----
   1

Jira issue: CRDB-5125

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.P-3Issues/test failures with no fix SLAS-3-erroneous-edge-caseDatabase produces or stores erroneous data without visible error/warning, in rare edge cases.T-sql-queriesSQL Queries Team

    Type

    No type

    Projects

    Status

    Bugs to Fix

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions