Skip to content

Generate typed PostgreSQL real literals for float constants - #4176

Open
gabisonia wants to merge 1 commit into
npgsql:mainfrom
gabisonia:fix/4147-float-literal
Open

gabisonia wants to merge 1 commit into
npgsql:mainfrom
gabisonia:fix/4147-float-literal

Conversation

@gabisonia

Copy link
Copy Markdown

A LINQ filter such as r.Single == 0.1f can miss a row containing that value. The provider emits a bare 0.1, which PostgreSQL interprets as numeric. The same filter with a real parameter finds the row.

Emit REAL '0.1' for the constant so both comparisons use single precision. Range bounds still use the underlying float text, including when a value converter supplies the bound. The existing constant and parameter equality tests now use 0.1f to exercise the reported case.

The Release build passed. The local CI test selection had 29,961 passes, 227 skips, and one failure. The same inheritance test, TPCInheritanceQueryNpgsqlTest.Can_insert_update_delete, also failed on clean main with the same generated ID mismatch. An independent PostgreSQL check round-tripped 1,035 float values under de-DE, including negative zero, subnormals, infinities, and NaN.

Fixes #4147.

This branch has not been deployed

No deployments
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.

float constants are inlined without a type, so r.Single == 0.1f never matches

1 participant