Skip to content

Format storage parameter values with the invariant culture - #4115

Open
Sorbitol wants to merge 1 commit into
npgsql:mainfrom
Sorbitol:fix-storage-parameter-culture
Open

Sorbitol wants to merge 1 commit into
npgsql:mainfrom
Sorbitol:fix-storage-parameter-culture

Conversation

@Sorbitol

Copy link
Copy Markdown

GetStorageParameters formatted non-bool, non-string values with ToString(), so a double such as HasStorageParameter("autovacuum_vacuum_scale_factor", 0.01) became 0,01 under comma-decimal cultures and broke CREATE TABLE … WITH (…), CREATE INDEX … WITH (…) and ALTER TABLE … SET (…). It now uses Convert.ToString(value, CultureInfo.InvariantCulture), as the sequence DDL in the same file already does.

Test: Create_table_with_storage_parameter_is_culture_invariant in MigrationsNpgsqlTest creates a table with that parameter under a culture whose decimal separator is ,, and asserts the generated SQL and the scaffolded value. Without the fix it fails with 42601: syntax error at or near "01". The ALTER TABLE path goes through the same helper.

Ran locally with the pinned SDK (11.0.100-rc.3.26522.148) against postgis/postgis:18-3.6:

  • the new test: fails before the fix, passes after;
  • MigrationsNpgsqlTest and MigrationsInfrastructureNpgsqlTest: 280 passed, 2 skipped;
  • EFCore.PG.Tests: 770 passed;
  • dotnet format --verify-no-changes on the changed files: clean.

Fixes #4114

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

Numeric storage parameters are formatted with the current culture, so migrations emit 0,01 instead of 0.01

1 participant