Repository navigation
fix: correct the storage parameter comment and pin invariant formatting (#97) - #109
Merged
Merged
Conversation
The custom generator's comment said it mirrored Npgsql's formatting with
numbers invariant. Npgsql's generator (10.0.0) formats storage parameters
with the current culture: a fractional value on a column-only index renders
x=0,25 under de-DE and tr-TR and x=0٫25 under ar-SA, which PostgreSQL
rejects with a syntax error. The comment now says so, the PostgreSQL index
guide says to pass a fractional value as a string ('0.25' is accepted),
and a test pins this package's own generator to invariant formatting under
de-DE, tr-TR and ar-SA; formatting with the current culture fails all three.
Fractional values are not rewritten to strings on the stock path: no
built-in index access method takes a fractional storage parameter, the
failure is loud, and existing migrations would keep the culture-sensitive
value anyway.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #97
Problem
HasStorageParameter("x", 0.25)on a column-only complex index renders through Npgsql's stock generator, which formats numbers with the current culture. Probed against Npgsql 10.0.0:WITH (x=0.25)WITH (x=0,25)WITH (x=0٫25)PostgreSQL 18 rejects
WITH (fillfactor=0,25)withsyntax error at or near "25", so this is a loud failure, not a wrong value. The package's own generator (expression and NULLS-ordered indexes) renders invariantly. Its comment ("Mirrors Npgsql's own formatting: … numbers invariant") was wrong about the stock path.Change
NpgsqlComplexIndexSqlGenerator.FormatStorageParameter: the comment now says what Npgsql does and what this generator does differently. The code is unchanged.docs/postgresql-indexes.md: pass a fractional storage parameter as a string,HasStorageParameter("x", "0.25"). Both generators render it asx='0.25', and PostgreSQL reads a quoted reloption as the number (checked on 18:fillfactor='70'andautovacuum_vacuum_scale_factor='0.25'are stored as70and0.25).### FixedDocs line in the root and PostgreSQL changelogs.Decision: fractional values are not forwarded as invariant strings.
buffering.HasIndex(…).HasStorageParameterhas the same behaviour, so the fix belongs upstream, where both paths share it. I found no existing upstream issue. Filing one on npgsql/efcore.pg is left to the maintainer.Tests
NpgsqlStorageParameterTests.Fractional_storage_parameter_is_culture_invariant(de-DE, tr-TR, ar-SA): this package's generator rendersWITH (x=0.25). WithFormatStorageParameterswitched toCurrentCulture, all three rows fail.🤖 Generated with Claude Code