Repository navigation
docs: typed filters over Trim/Substring are re-created; concurrent TPC copies apply (#170, #171) - #173
Merged
Conversation
…pies apply (#170, #171) The #72 Changed answers row (root and PostgreSQL changelogs) and its upgrade entry named typed expression indexes only. Typed filters on indexes and exclusion constraints use the same translator, are re-created by the first migrations add after 5.4.1, and a Trim filter covers other rows now. Measured from a real v5.4.1 snapshot: every typed filter over Trim, TrimStart, TrimEnd and Substring is dropped and re-created, a ToLower filter is not, the second diff is empty. The TPC entry said nothing of a failing migration is applied. Copies of an index declared with IsCreatedConcurrently() run outside the transaction, so earlier operations stay applied and an invalid index is left behind; the entry now says how to recover. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #170
Closes #171
Problem
#170. #72 changed how
Trim,TrimStart,TrimEndandSubstringrender in the typed translator, which also serves typed filters on indexes and exclusion constraints. The### Changed answersrow (root and PostgreSQL changelogs, i.e. the 5.5.0 release notes) and the upgrade entry named typed expression indexes only. A typed filter is stored as rendered SQL, so a 5.4.1 snapshot holds the old text and the firstmigrations addre-creates it. ATrimfilter also covers other rows now.#171. The TPC entry in
docs/upgrading.mdsaid a failing migration applies nothing. Copies of an index declared withIsCreatedConcurrently()run outside the transaction.Change
CHANGELOG.md,src/EFCore.ComplexIndexes.PostgreSQL/CHANGELOG.md: the Typed expression indexes render Substring and Trim differently from EF Core's queries, so no query uses them #72 row names typed filters and says a typed filter can cover other rows (x.Code.Trim() != ""leaves out a tabs-only value). 59 and 57 words.docs/upgrading.md, "Substring and Trim render as EF Core's queries" (heading and anchor kept):TrimStart/TrimEndrows to the table;Substringfilters cover the same rows;migrations addre-creates, and what to clean up first (23505, 23P01), with a query that finds rows a filter now covers.docs/upgrading.md, "Declarations on a TPC type…": withIsCreatedConcurrently(), earlier operations stay applied, an invalid index stays behind and the migration isn't recorded, so a re-run fails (42P07). Then how to recover: apg_indexquery andDROP INDEX CONCURRENTLY.DocumentationApiTests:TrimStart/TrimEndadded to the BCL allowlist, since the table now calls them.Tests
The upgrade was measured on a real v5.4.1 snapshot. I wrote it from a
v5.4.1worktree with EF's snapshot generator, compiled it with Roslyn on this branch and diffed it against the live model through the Npgsql differ. The model has typed filters over each method onHasComplexIndex(unique and not),HasComplexCompositeIndex,HasExpressionIndexandHasExclusionConstraint, plus aToLowerfilter as a control. The firstmigrations addgave 21 operations:CREATE EXTENSION IF NOT EXISTS btree_gist;btrim(…),substr(…, 1, 2)→substring(…, 1, 2));btrim/ltrim/rtrim(…, E' \t\n\r'),substringwith two arguments, one argument and a column start;ToLowercontrol was not touched, and the second diff is empty.On PostgreSQL 18 (psql):
btrim(v) <> ''coversE'\t'andbtrim(v, E' \t\n\r') <> ''doesn't;= 'abc'takes inE'abc\t'only under the new trim, and the guide's query returns exactly that row;substrandsubstringagree for starts of 0, negative and 1 argument;CREATE UNIQUE INDEX CONCURRENTLYleaves an invalid index that the guide'spg_indexquery lists, re-creating it fails with "already exists", andDROP INDEX CONCURRENTLYclears it.The EF side of #171 wasn't run live: the migrator commits before a
TransactionSuppressedcommand, and the history row comes last. That is documented EF Core behaviour.The unit suite passed (631). The typed-filter rendering of
Trimis already pinned against EF'sToQueryString()byTranslatorParitySweepTests, which renders filters throughWhere.🤖 Generated with Claude Code