Skip to content

Typed expression indexes: a captured Substring start renders unfolded, where EF Core folds it #117

Closed

Description

@CaffeinatedCoder

Problem

A typed expression index or filter whose Substring start is a captured variable renders the start unfolded, where EF Core's query for the same lambda renders the folded value:

Lambda Package EF Core
x.Code.Substring(start) with int start = 1 substring("Code", (1 + 1)) substring("Code", 2)
x.Code.Substring(start, 3) substring("Code", (1 + 1), 3) substring("Code", 2, 3)

A literal start (Substring(1)) is already folded. PostgreSQL folds (1 + 1) before it matches an index to a query, so the index serves the query and no answer changes; the rendering still disagrees with EF Core's for no reason.

Fix

Evaluate a start that does not depend on the entity and render the folded value, as for a literal. The stored template changes only for indexes whose Substring rendering #72 already changes in 5.5.0, so it adds no re-create.

Found by the translator parity sweep (#101).

Activity

  1. added this to the 5.5.0 milestone on Oct 20, 2026
  2. added
    bug
    severity/low
    package/postgresql
    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-indexesbugpackage/postgresqlseverity/low

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions