Skip to content

Binder, slice 1: templates stored as segments, format v 3, and a resolver that scans nothing #178

Done

Description

@CaffeinatedCoder

2026-11-24: built on the branch feat/178-segments, not committed. Offline it passes: 744 of the kernel's tests, 183 of the PostgreSQL package's, 85 of the second provider's. Live, on the driver Npgsql 11.0.0: 4 of the kernel's and 73 of the PostgreSQL package's on PostgreSQL 16 and on 18, the handover from 5.x among them; the second provider's 86 on SQL Server 2022; the consumer smoke test's 47 rows on PostgreSQL 18, packed as 11.0.0-preview.2.

What is there:

  • SqlTemplate, a value of segments (SqlSegment.Text, Column, Raw), stored as a list: ["lower(",{"col":"Email.Value"},") = 'a'"], {"raw":…} for SQL written by hand. v is 3, and a v of 2 is refused with the message that says to scaffold again.
  • The resolver reads segments and scans nothing. SQL written by hand reads the whole table beside its columns; a package's own text reads nothing.
  • Predicate.And composes segments. Hand-written SQL that reads like its text is not taken for it.
  • PgExclusion stores sql and where as segments. The 5.x reader reads an expression and a filter as SQL written by hand.
  • Each of the seven new rules was removed in turn, and a test failed for each.

Three things are not as the issue says:

  1. The default name's rule is unchanged. As written here ("a column's own name, and of text the ASCII letters and digits"), lower({first_name}) would be named lowerfirst_name where 5.x and preview.1 name it lowerfirstname, and every such object would be renamed at the handover from 5.x, against SchemaKit: moving from EFCore.ComplexIndexes 5.x adds no migration, or exactly the one the guide documents #10. The name is built from the segments now, by the same letters-and-digits rule as before. Making it independent of the runtime's Unicode tables needs a rule that agrees with 5.x on ASCII, and probably a new epoch: to decide.
  2. Predicate and KeyTarget.Template have their new public shape already, which Binder, slice 2: a declaration is held unbound until the model is finalized, then bound and checked #179 lists: they hold a SqlTemplate and are not made from a string. Storing segments left no way to keep the string.
  3. {Path} is still looked for, once, where text becomes segments: SqlTemplate.FromPlaceholders for the kernel's translator, which writes placeholders until Binder, slice 2: a declaration is held unbound until the model is finalized, then bound and checked #179 and Binder, slice 3: the translator takes nullability and literals from the model #180, and SqlTemplate.Raw for a 5.x filter. Nothing stored is scanned.

Part of #114 (decided 2026-11-24). First of three slices; the translator still runs at the call.

Change

Done when

The verbatim keys and values of DeclarationStoreTests and PgExclusionDeclarationTests are the new ones, the handover from the 5.x fixture still diffs to nothing and applies to the same catalog on PostgreSQL 16 and 18, and the version is 11.0.0-preview.2 with its changelog section.

Activity

  1. added this to the 11.0.0 milestone on Nov 24, 2026
  2. added
    enhancement
    breaking
    package/core
    on Nov 24, 2026
  3. added
    package/postgresql
    area/expression-indexes
    on Nov 24, 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-indexesbreakingenhancementpackage/corepackage/postgresql

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions