pg_duckdb icon indicating copy to clipboard operation
pg_duckdb copied to clipboard

Minimum hugeint overflows in conversion to PG numeric

Open JelteF opened this issue 9 months ago • 0 comments

Description

This query returns 0:

select * from duckdb.query($$ select '-170141183460469231731687303715884105728'::hugeint as result $$);

But one higher works fine:

select * from duckdb.query($$ select '-170141183460469231731687303715884105728'::hugeint + 1 as result $$);

The reason for this is that this line overflows, because the positive 170141183460469231731687303715884105728 cannot be represented in a signed int128.

Found by #577

JelteF avatar Feb 14 '25 10:02 JelteF