Skip to content

Lambda translator, first slice: the 5.x translator in the kernel, expressions and predicates with null compensation #71

Closed

Description

@CaffeinatedCoder

The first slice of #26. Decided by the maintainer on 2026-11-12: the translator comes before the PostgreSQL package (#25), so that preview.1's exclusion constraints take a lambda filter. The plan had it in preview.2.

Problem

A declaration holds SQL templates, and nothing in SchemaKit turns a lambda into one. A consumer of 5.x that passes its exclusion filters as lambdas could not try a preview with SQL filters only without rewriting them.

Change

NpgsqlLinqIndexTranslator of 5.x, ported into the kernel in full and internal:

  • Expressions: property paths, ToLower, ToUpper, Trim, TrimStart, TrimEnd, Substring, Replace, Length, concatenation, ??, Nullable<T>.Value, constants and captured values as literals.
  • Predicates: the six comparisons, &&, ||, !, boolean members, HasValue, comparisons with null, and EF Core's null compensation: x.Tag != "blocked" keeps the rows whose tag is null, as C# does.
  • Refusals at the declaration: an enum comparison, a literal with no portable spelling, a member of a scalar, a method outside the set.
  • The accepted constructs stay data (the tables the sweep and the analyzer read).
  • The output is a template in the resolver's grammar: {Path} placeholders outside single-quoted literals. 5.x escaped a brace in a literal as {{ for its template grammar; the resolver has one grammar and no escape, so a literal is written as it is.

The spellings are PostgreSQL's. SQL Server's come with its package (#29).

Not in this slice (stays in #26)

  • The parity sweep against EF Core's ToQueryString() and the answers-alike run on PostgreSQL 18, ported from 5.x as files.
  • [SchemaFunction] markers for other packages.
  • The declaration values that call it (Predicate.Of, Sql.Raw), which come with the first provider vocabulary (PgExclusion: exclusion constraints end to end #25).

Done when

Each rule of the 5.x translator has a test here that fails when the rule is undone, and a translated template resolves through the kernel's resolver.

Activity

  1. added this to the 11.0.0 milestone on Nov 12, 2026
  2. added
    enhancement
    package/core
    area/expression-indexes
    on Nov 12, 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-indexesenhancementpackage/core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions