Fix SQLite decimal comparison with turkish culture#37443
Merged
roji merged 3 commits intodotnet:mainfrom Jan 3, 2026
Merged
Conversation
Updated SqliteRelationalConnection to parse decimals using CultureInfo.InvariantCulture for collation, ensuring consistent behavior across cultures. Added a test to verify correct ordering of decimal values under Turkish culture.
There was a problem hiding this comment.
Pull request overview
This PR fixes a culture-dependent bug in SQLite decimal collation where decimal comparison would fail when the application runs under a culture that uses a different decimal separator (e.g., Turkish using comma instead of period).
- Updated
SqliteRelationalConnection.CreateCollationto useCultureInfo.InvariantCulturewhen parsing decimal strings - Added test coverage with Turkish culture (tr-TR) to verify decimal ordering works correctly regardless of the application's current culture
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/EFCore.Sqlite.Core/Storage/Internal/SqliteRelationalConnection.cs | Fixed decimal collation to use InvariantCulture when parsing decimal strings, ensuring correct comparison regardless of current culture |
| test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs | Added test with Turkish culture to verify decimal ordering works correctly with cultures that use different decimal separators |
roji
approved these changes
Jan 3, 2026
test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs
Outdated
Show resolved
Hide resolved
test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs
Outdated
Show resolved
Hide resolved
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.
Fixes #37432
Summary of the changes
Details
SqliteConnection.CreateCollationto useCultureInfo.InvariantCulturewhen parsing decimal stringsFixes
This addresses the issue where SQLite decimal comparison would fail when the application was running under a culture that uses a different decimal separator (e.g., Turkish using comma instead of period).