duckdb / duckdb/pg_duckdb

[bug]: Lose numeric zeros when rounding in duckdb

Open
#309 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
3.2k
Forks
204
PR merge metrics
No merged PRs in 30d

Description

### Description

```sql
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.

Contributor guide

Open the contributing guide

Research direction

Start by running the SQL example under the PostgreSQL and DuckDB execution paths and comparing the numeric output. Trace how round(a, 2) represents and formats its result, then verify that 1.8000 is displayed as 1.80, 1.346 as 1.35, and the relevant TPCDS output matches PostgreSQL.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, postgres, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.