Repository navigation
feat!: the spelling of a lambda is the provider's package's - #186
Merged
Merged
Conversation
SqlSpelling is an abstract class of the contract, and the kernel holds none: a package derives its own. It says which 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 the negation of a comparison that can be null. The kernel keeps the walk over the lambda and what is C#'s or the same SQL everywhere: the conversions that keep a value, null compensation, the comparison and boolean operators. PostgreSQL's tables are NpgsqlSpelling in its package and write what they wrote; PgSchema.Spelling hands it out, marked SK9001. SqlSpelling.PostgreSql is gone. The second provider's tests have a spelling for SQL Server and one for SQLite through the public contract, compared with EF Core's ToQueryString(). SQL Server gave two members their shape: Condition takes the negation, and an argument arrives as SQL and as its value. Closes #184 Co-Authored-By: Claude Fable 5.2 <[email protected]>
CaffeinatedCoder
enabled auto-merge
November 25, 2026 09:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #184
The last piece of the binder (#114) and of #112.
Problem
The kernel held one spelling, PostgreSQL's, with the tables it is made of, and
SqlSpellingnamed a provider. A package for another database had no value to pass toKeyTarget.OfandPredicate.Of, and what it got by passing the one there was PostgreSQL's SQL.Change
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.SilentConversions, null compensation, the comparison and boolean operators,NULL,Nullable<T>.ValueandHasValue.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.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:
!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.1 + 1), Npgsql's do. So an argument reaches the spelling as SQL and, when it reads nothing from the entity, as its value.ISNULLwhere Npgsql writescoalesce, for??and for a nullable operand of a concatenation.Decided here, to be confirmed:
=,<>,<,AND,OR,NOT,IS NULL). They are the same on the three databases, and the null compensation is built from them.PgSchema.Spelling. Moving them to the package's tests needs the kernel's internals there.{Path}, not as segments. It is the grammarFromPlaceholdershas already.Not here:
ORat all (SqlServerSpellingLiveTests), so what a nullable column needs there is SqlServerIndex: clustered and nonclustered, typed #29's.Tests
Offline: 751 (kernel), 195 (PostgreSQL package), 87 (second provider). Live: 4 and 73 on PostgreSQL 16 and on 18, 86 on SQL Server 2022. The consumer smoke test: 47 rows.
Fourteen rules were changed in turn and a test failed for each. For
PgSchema.Spellingwithout the mark the kept log shows the SK9001 diagnostic and not the test's name; the name below is inferred.A_condition_is_spelled_as_SQL_Servers_queries_spell_it,A_package_spells_a_lambda_with_a_spelling_of_its_ownCASEin the kernelA_condition_is_spelled_as_SQL_Servers_queries_spell_itAn_expression_is_spelled_as_SQLites_queries_spell_it??written in the kernelA_condition_is_spelled_as_SQL_Servers_queries_spell_itA_substring_starts_one_later, the sweepSqlSpellingThe_kernel_holds_no_spelling_and_its_surface_names_no_providerPgSchema.Spellingwithout the markThe_kernels_lambda_factories_ask_for_the_opt_inlowerin capitals in PostgreSQL's tableCOALESCEforISNULLin SQL Server's spellingA_condition_is_spelled_as_SQL_Servers_queries_spell_itbtrimin SQLite's spellingSQLite_takes_what_its_spelling_writes_for_Trimand two morebreaking:SqlSpelling.PostgreSqlis gone andSqlSpellingis abstract; both are the contract's (SK9001).🤖 Generated with Claude Code