Repository navigation
Description
2026-11-25: in PR #186 (feat/184-spelling). Offline: 751 of the kernel's tests, 195 of the PostgreSQL package's, 87 of the second provider's. Live: 4 and 73 on PostgreSQL 16 and on 18, 86 on SQL Server 2022, the consumer smoke test's 47 rows.
What is there:
SqlSpellingis an abstract class of the contract, and the kernel holds none. A package derives its own: the methods and members a lambda may use and what each is written as, the literals written without a column, concatenation and its operands,??, a boolean where a condition stands (and its negation), and the negation of a comparison that can be null. SQL goes in and out in the grammar ofSqlTemplate.FromPlaceholders.- The kernel keeps the walk and what is C#'s or the same SQL everywhere:
SilentConversions, null compensation, the comparison and boolean operators,NULL,Nullable<T>.ValueandHasValue. - PostgreSQL's tables are
NpgsqlSpellingin its package, unchanged in what they write:LambdaTranslatorTestsand the parity sweep pass withwaivers.txtuntouched.PgSchema.Spellinghands it out, markedSK9001, for a package that takes lambdas for PostgreSQL declarations of its own;SqlSpelling.PostgreSqlis gone. - The second provider's tests have a spelling for SQL Server and one for SQLite, a handful of constructs each, through the public contract.
SpellingParityTestscompares 16 conditions on SQL Server and 6 expressions on SQLite with EF Core'sToQueryString(), but for the kernel's parentheses around a group. PublicSurfaceTestsholds that the kernel has no spelling of its own and that no public name of it names a provider.
What the second provider changed in the contract's shape:
- SQL Server has no boolean that is a condition, and its queries write
!x.Activeas[Active] = CAST(0 AS bit). SoConditiontakes the negation, and the kernel hands a boolean negated once to it. A boolean under a negation that is already pushed down is still wrapped inNOT (…), as before: changing that would change what PostgreSQL stores. - SQL Server's queries do not fold a substring's start (
1 + 1), Npgsql's do. So an argument reaches the spelling as SQL and, when it reads nothing from the entity, as its value. - SQL Server writes
ISNULLwhere Npgsql writescoalesce, for??and for a nullable operand of a concatenation.
Decided here, to be confirmed:
- The comparison and boolean operators stay in the kernel (
=,<>,<,AND,OR,NOT,IS NULL). They are the same on the three databases, and the null compensation is built from them. - The translator's tests and the sweep stay in the kernel's test project, which now references the PostgreSQL package and reads its spelling through
PgSchema.Spelling. Moving them to the package's tests needs the kernel's internals there. - SQL passes between the kernel and a spelling as text with
{Path}, not as segments. It is the grammarFromPlaceholdershas already.
Not here:
- The kernel's internal copies of provider rules in the planner (SQLite's rebuild list, the drop-and-add rule, operation types by name) are Provider effect adapters: what a MigrationOperation does is the provider package's to say, not the kernel's #116's.
- The kernel's parentheses around a group and a compensated comparison differ from EF Core's on SQL Server. SQL Server's filtered index takes no
ORat all (SqlServerSpellingLiveTests), so what a nullable column needs there is SqlServerIndex: clustered and nonclustered, typed #29's. - The analyzer (Analyzer: the translator's refusals as build errors, in 11.0.0 #31) is not built; it reads the spelling's tables when it is.
Fourteen rules were changed in turn and a test failed for each:
| Changed | Fails |
|---|---|
| A negation of a boolean is not handed to the spelling | A_condition_is_spelled_as_SQL_Servers_queries_spell_it, A_package_spells_a_lambda_with_a_spelling_of_its_own |
| A boolean stands as a column on every database | the same two |
The negated comparison written as PostgreSQL's CASE in the kernel |
A_condition_is_spelled_as_SQL_Servers_queries_spell_it |
| Concatenation written in the kernel | that, and An_expression_is_spelled_as_SQLites_queries_spell_it |
?? written in the kernel |
the same two |
| A string literal written in the kernel | A_condition_is_spelled_as_SQL_Servers_queries_spell_it |
| The spelling's members not asked | four of the kernel's, the sweep among them, and both parity tests |
| An argument never handed over as a value | A_substring_starts_one_later, the sweep |
A static spelling on SqlSpelling |
The_kernel_holds_no_spelling_and_its_surface_names_no_provider |
PgSchema.Spelling without the mark |
The_kernels_lambda_factories_ask_for_the_opt_in |
lower in capitals in PostgreSQL's table |
6 of the kernel's, 11 of the PostgreSQL package's |
COALESCE for ISNULL in SQL Server's spelling |
A_condition_is_spelled_as_SQL_Servers_queries_spell_it |
| SQL Server's spelling folds the start | the same |
btrim in SQLite's spelling |
SQLite_takes_what_its_spelling_writes_for_Trim and two more |
Split from #180 on 2026-11-24; what is left of #112, point 1, and of #114.
Problem
The kernel holds one spelling, PostgreSQL's, with the tables it is made of (StringMethods, ValueMembers, the operator sets, LiteralTypes, SilentConversions), and SqlSpelling names a provider, which nothing else in the kernel's surface does. A package for another database has no value to pass.
Change
SqlSpellingbecomes what a provider's package implements or builds: its functions, its operators, how it writes what the kernel's translator asks it to.- The PostgreSQL tables move to the PostgreSQL package. The parity sweep, the probes and the analyzer (Analyzer: the translator's refusals as build errors, in 11.0.0 #31) read them there.
- The kernel keeps the walk over the lambda and the rules that are C#'s: null compensation, the conversions that keep a value.
Done when
The kernel names no provider and holds no SQL of one, PublicSurfaceTests holds it, and the second provider's tests spell a lambda for SQL Server without going around the contract.
Activity