Skip to content

Add detection of out-of-bound NUMERICs (1.5) - #563

Merged
staticlibs merged 1 commit into
duckdb:v1.5-variegatafrom
staticlibs:out_of_bound_numerics_15
Sep 1, 2026
Merged

Add detection of out-of-bound NUMERICs (1.5)#563
staticlibs merged 1 commit into
duckdb:v1.5-variegatafrom
staticlibs:out_of_bound_numerics_15

Conversation

@staticlibs

Copy link
Copy Markdown
Member

This is a backport of the PR #562 to v1.5-variegata stable branch.

This PR adds detection of NaN, Infinity and -Infinity values of Postgres' NUMERIC colums with the following logic:

  • for bound NUMERIC(p,s) columns:

    • if options pg_numeric_nan_as_null is enabled (default: TRUE) - NULL is returned on NaN value
    • otherwise, an error is thrown
    • Postgres bound NUMERIC(p,s) columns cannot hold Infinity or -Infinity values
  • for unbound NUMERIC columns:

    • if option pg_numeric_as_varchar is enabled (default: FALSE) - then a VARCHAR representation is returned as NaN, Infinity or -Infinity string
    • otherwise DOUBLE value is returned holding DuckDB-native NaN, Infinity or -Infinity double number

Testing: new test is added with an out-of-bound coverage of both options and of all NUMERIC storage types.

Ref: duckdb/duckdb#23971

@staticlibs
staticlibs force-pushed the out_of_bound_numerics_15 branch from fedb875 to b80db7c Compare September 1, 2026 18:47
This is a backport of the PR duckdb#562 to `v1.5-variegata` stable branch.

This PR adds detection of `NaN`, `Infinity` and `-Infinity` values of
Postgres' `NUMERIC` colums with the following logic:

 - for bound `NUMERIC(p,s)` columns:
   - if options `pg_numeric_nan_as_null` is enabled (default: `TRUE`) -
    `NULL` is returned on `NaN` value
   - otherwise, an error is thrown
   - Postgres bound `NUMERIC(p,s)` columns cannot hold `Infinity` or
    `-Infinity` values

 - for unbound `NUMERIC` columns:
   - if option `pg_numeric_as_varchar` is enabled (default: `FALSE`) -
    then a `VARCHAR` representation is returned as `NaN`, `Infinity` or
    `-Infinity` string
   - otherwise `DOUBLE` value is returned holding DuckDB-native `NaN`,
    `Infinity` or `-Infinity` double number

Testing: new test is added with an out-of-bound coverage of both options
and of all `NUMERIC` storage types.

Ref: duckdb/duckdb#23971
@staticlibs
staticlibs force-pushed the out_of_bound_numerics_15 branch from b80db7c to 8813d8c Compare September 1, 2026 19:00
@staticlibs staticlibs closed this Sep 1, 2026
@staticlibs
staticlibs deleted the out_of_bound_numerics_15 branch September 1, 2026 20:06
@staticlibs
staticlibs restored the out_of_bound_numerics_15 branch September 1, 2026 20:07
@staticlibs staticlibs reopened this Sep 1, 2026
@staticlibs
staticlibs merged commit 4053b61 into duckdb:v1.5-variegata Sep 1, 2026
8 checks passed
@staticlibs
staticlibs deleted the out_of_bound_numerics_15 branch September 1, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant