Repository navigation
fix(postgresql): typed filters compare chars as chars and translate HasValue and Value - #122
Merged
Merged
Conversation
This was referenced Oct 20, 2026
…asValue and Value (#80) C# compares a char as its code, so x.Grade == 'A' arrived as Convert(x.Grade) == 65 and rendered "Grade" = 65, which PostgreSQL refuses at apply. HasValue, Value and any other member of a scalar type (CreatedAt.Year) passed the declaration as a property path and failed at migrations add with "Could not resolve property path". A constant compared with a converted char is rendered as the char it was written as. Nullable<T>.Value is the column and HasValue its null check (IS NOT NULL, pushed into IS NULL under a negation), both as EF Core renders them, and every other member of a scalar type is refused at the declaration. Verified with the translator change reverted: the three new tests fail, and the parity sweep fails 274 rows, which this change removes from waivers.txt. The 36 rows left there are negated .Value comparisons, shaped as the other negated nullable comparisons are (#118). Co-Authored-By: Claude Opus 5.5 <[email protected]>
CaffeinatedCoder
force-pushed
the
fix/80-char-hasvalue-scalar-members
branch
from
October 20, 2026 06:35
472139d to
cfa3ed0
Compare
CaffeinatedCoder
force-pushed
the
tests/101-translator-parity-sweep
branch
from
October 20, 2026 06:35
5549f45 to
bf545be
Compare
CaffeinatedCoder
changed the base branch from
tests/101-translator-parity-sweep
to
main
October 20, 2026 06:56
# Conflicts: # CHANGELOG.md # src/EFCore.ComplexIndexes.PostgreSQL/CHANGELOG.md
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 #80
Stacked on #121 (the parity sweep); merge that first.
Problem
x => x.Grade == 'A'on achar: C# compares the char's code, so the translator rendered"Grade" = 65, and PostgreSQL refused the migration at apply (operator does not exist: character = integer). Also inside a coalesce ((x.Backup ?? 'B') == 'A') and on aToJson()member.x => !x.RevokedAt.HasValue,x => x.Count.Value > 5,x => x.CreatedAt.Year > 2020: accepted at the declaration as the paths{RevokedAt.HasValue},{Count.Value},{CreatedAt.Year}, thenmigrations addthrewCould not resolve property path. The same in typed expression indexes. The issue's scope was widened fromHasValueto every member of a scalar type, which the sweep showed fail the same way.Change
NpgsqlLinqIndexTranslator:charoperand renders as the char literal ('A'), as EF Core renders it;ValueMembersgainsNullable<T>.Value(the column) andNullable<T>.HasValue(IS NOT NULL); in a filterHasValuestands bare and a negation becomesIS NULL, and abool?'s.Valuestands on its own like a boolean column;string,decimal, dates and times,Guid, enums, arrays) is refused at the declaration with a message naming the member.waivers.txt: the Typed filters: char comparisons render an integer, and HasValue and other scalar members fail at migrations add, not at the declaration #80 block is gone (274 rows now agree with EF Core or are refused at the declaration). Its 36 remaining rows, negated comparisons over.Value, move to the Typed filters: null checks over a computed operand and negated nullable comparisons are shaped unlike EF Core's #118 block with the other negated nullable comparisons..Value,.HasValueand char comparisons. Changelog: two### Fixedlines (root and PostgreSQL).Tests
NpgsqlTypedFilterTests: char comparisons render a char literal;HasValue/Valuetranslate;CreatedAt.Year,RevokedAt.Value.MonthandCreatedAt.Dayare refused at the declaration.HasValueand.Valuerows against PostgreSQL 18.🤖 Generated with Claude Code