risingwavelabs / risingwave

SQL stream processing, analytics, and management. We decouple storage and compute to offer efficient joins, instant failover, dynamic scaling, speedy bootstrapping, and concurrent query serving.
https://www.risingwave.com/slack
Apache License 2.0
6.62k stars 543 forks source link

PG-incompatibility: `round(decimal, digit)` should add trailing zeros #7809

Open xiangjinwu opened 1 year ago

xiangjinwu commented 1 year ago

Describe the bug

No response

To Reproduce

dev=> select round(42, 2);
 round 
-------
    42
(1 row)

Expected behavior

In PostgreSQL:

test=# select round(42, 2);
 round 
-------
 42.00
(1 row)

Additional context

Note that in some cases the trailing zeros may be dropped automatically: #385

jon-chuang commented 1 year ago

Due to our rust_decimal type, we can also only support up to 28 dps of scale factor i.e. https://github.com/risingwavelabs/risingwave/pull/7819

Further, the behaviour of rust_decimal will be to retain the previous scale if the rounding is larger than the current scale https://github.com/paupino/rust-decimal/pull/575

github-actions[bot] commented 1 year ago

This issue has been open for 60 days with no activity. Could you please update the status? Feel free to continue discussion or close as not planned.