Skip to content

Typed filters: char comparisons render an integer, and HasValue and other scalar members fail at migrations add, not at the declaration #80

Closed

Description

@CaffeinatedCoder

Problem

Typed-filter constructs that fail later than the declaration, although the docs promise the subset "fails at the declaration":

  • char comparisons. C# lifts x.Grade == 'A' to Convert(x.Grade, int) == 65; the translator strips the Convert and renders "Grade" = 65, which PostgreSQL rejects at apply (operator does not exist: character = integer). EF renders 'A'.
  • HasValue. x => !x.RevokedAt.HasValue is accepted at the declaration as the path {RevokedAt.HasValue}, then migrations add throws Could not resolve property path 'RevokedAt.HasValue'. HasValue is a common spelling of the null check.
  • Any other member of a scalar type (scope added 2026-10-20, from the parity sweep Tests: sweep typed filters and typed expression indexes against EF Core's ToQueryString #101): x.RevokedAt.Value, x.CreatedAt.Year and the like are accepted at the declaration as paths ({CreatedAt.Year}) and fail at migrations add the same way, in filters and in typed expression indexes alike. char comparisons fail the same way inside a coalesce ((x.Grade ?? 'A') == 'A') and against a ToJson() member.

Fix

Render a char literal when a converted char operand meets an int constant; translate HasValue to IS NOT NULL (and .Value to the column), and refuse every other member of a scalar type at the declaration.

Loud. Found by the 5.5.0 pre-tag analysis (PostgreSQL satellite).

Activity

  1. added this to the 5.5.1 milestone on Oct 19, 2026
  2. added
    bug
    severity/low
    package/postgresql
    area/indexes
    on Oct 19, 2026
  3. modified the milestones: 5.5.1, 5.5.0 on Oct 20, 2026
  4. changed the title [-]Typed filters: char comparisons render an integer and HasValue fails at migrations add, not at the declaration[/-] [+]Typed filters: char comparisons render an integer, and HasValue and other scalar members fail at migrations add, not at the declaration[/+] on Oct 20, 2026
  5. added
    area/expression-indexes
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/expression-indexesarea/indexesbugpackage/postgresqlseverity/low

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions