duckdb / pg_duckdb

DuckDB-powered Postgres for high performance apps & analytics.
MIT License
1.54k stars 54 forks source link

[bug]: Lose numeric zeros when rounding in duckdb #309

Open JelteF opened 2 weeks ago

JelteF commented 2 weeks ago

Description

create table t(a numeric);
insert into t values (1.8000), (1.346);
select round(a, 2) from t;

With PG execution this returns:

 round
───────
  1.80
  1.35

With DuckDB execution this returns:

 round
───────
   1.8
  1.35

So we somehow lose the trailing 0 after rounding to two decimals. This causes differences in TPCDS output.

JelteF commented 2 weeks ago

FYI it seems that's because NUMERIC without a size is downgraded to a double in duckdb. I'm wondering if that's what we actually want to do.