Skip to content

Support PostgreSQL numeric infinities in PgNumeric - #5168

Open
LucaCappelletti94 wants to merge 1 commit into
diesel-rs:mainfrom
LucaCappelletti94:postgres-numeric-infinity
Open

Support PostgreSQL numeric infinities in PgNumeric#5168
LucaCappelletti94 wants to merge 1 commit into
diesel-rs:mainfrom
LucaCappelletti94:postgres-numeric-infinity

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Member

PostgreSQL accepts Infinity and -Infinity for unconstrained numeric, but Diesel rejects their binary sign words during decoding with InvalidNumericSign. Diesel also cannot bind those values today, because PgNumeric has no public value that represents either infinity.

This patch adds explicit PgNumeric variants for both infinity values, using PostgreSQL's wire sign words 0xD000 and 0xF000. BigDecimal remains finite-only, so reading either infinity as BigDecimal still returns an error, matching its existing NaN behavior.

This is, to my understanding, API breaking, but the only variant I could come up with is a second full-domain enum, for example PgNumericWithInfinities, maybe wrapping PgNumeric.

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review August 27, 2026 10:08
@LucaCappelletti94
LucaCappelletti94 force-pushed the postgres-numeric-infinity branch from 8076347 to f314c12 Compare August 28, 2026 07:42
@LucaCappelletti94
LucaCappelletti94 force-pushed the postgres-numeric-infinity branch from f314c12 to 8b55406 Compare August 28, 2026 10:11
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