You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typed expression indexes: string concatenation with a nullable operand differs from EF Core (COALESCE) #94
area/expression-indexesExpression, typed LINQ and JSON member indexesbugSomething isn't workingpackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQLseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred
A typed expression index over string concatenation with a nullable operand renders differently from EF Core's query translation, and with different semantics:
Lambda
Package
EF Core
x.Code + x.Name (string? Name)
("Code" || "Name")
"Code" || COALESCE("Name", '')
C# concatenation treats null as empty; PostgreSQL's || yields NULL. The index serves no EF query over the lambda, and a unique index on it leaves every row with a null Name unchecked (a NULL key).
Fix
Wrap nullable operands of a concatenation in COALESCE(…, ''), using the operand nullability #68 introduces, and pin it against ToQueryString() with the other expressions (#72). Changes the stored template, so the index re-creates once: a minor with a ### Changed answers row.
Found by the 5.5.0 pre-tag analysis (PostgreSQL satellite). Depends on #68.
area/expression-indexesExpression, typed LINQ and JSON member indexesbugSomething isn't workingpackage/postgresqlAffects EFCore.ComplexIndexes.PostgreSQLseverity/mediumInconsistency or failure in a narrow scenariosilentAnswers wrongly without throwing — fixes go in the next major, never deferred
Activity