Skip to content

scalar function round ignores second parameter #4191

@andygrove

Description

@andygrove

Describe the bug

round accepts two arguments, but is also defined as a unary function. The second parameter is ignored.

❯ select round(3.141592, 0);
+-----------------------------------+
| round(Float64(3.141592),Int64(0)) |
+-----------------------------------+
| 3                                 |
+-----------------------------------+
1 row in set. Query took 0.000 seconds.

❯ select round(3.141592, -2);
+------------------------------------+
| round(Float64(3.141592),Int64(-2)) |
+------------------------------------+
| 3                                  |
+------------------------------------+
1 row in set. Query took 0.000 seconds.

❯ select round(3.141592, 2);
+-----------------------------------+
| round(Float64(3.141592),Int64(2)) |
+-----------------------------------+
| 3                                 |
+-----------------------------------+
1 row in set. Query took 0.000 seconds.

To Reproduce
See above

Expected behavior
I expect the behavior to be consistent with Postgres round(v numeric, s int). User guide will also need updating.

Additional context
Related to #2420

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions