Skip to content

Sync to EF 11.0.0-preview.5.26251.112 - #3827

Merged
roji merged 1 commit into
mainfrom
sync-ef-26251
May 4, 2026
Merged

Sync to EF 11.0.0-preview.5.26251.112#3827
roji merged 1 commit into
mainfrom
sync-ef-26251

Conversation

@roji

@rojiroji commented May 4, 2026

Copy link
Copy Markdown
Member

Syncs to the latest EF Core daily build for preview.5.

EF-side PRs that required changes

PRChangeImpact
#38156Strip no-op SQL CASTs22 SQL baseline rewrites + 2 type mapping bug fixes (see below)
#38188Rename StructuredJsonPath.OrdinalsIndicesBuild fix in NpgsqlUpdateSqlGenerator
#38168Translate Any() over byte arrayAdded override on ByteArrayTranslationsNpgsqlTest.Any()

Type mapping bug fixes exposed by EF's new cast removal

1. DateInterval.End: wrong result type for date - interval

PostgreSQL returns timestamp without time zone for date - interval, but NpgsqlSqlExpressionFactory.ApplyTypeMappings always used the left operand's type mapping (date) for the result, ignoring the explicitly passed type mapping. Fixed by using typeMapping ?? newLeft.TypeMapping.

2. = ANY(scalar_subquery): syntactic cast incorrectly modeled as type cast

We used SqlUnaryExpression(Convert) to force PostgreSQL's array-form ANY() (vs. subquery-form), but both the subquery and cast had the same integer[] store type. This isn't a type mapping bug — it's a syntactic disambiguation. Moved the cast emission to NpgsqlQuerySqlGenerator.VisitArrayAny(), which detects ScalarSubqueryExpression and appends ::storeType directly in SQL generation.

CopilotAI review requested due to automatic review settings May 4, 2026 10:36

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs EFCore.PG to EF Core 11.0.0-preview.5.26251.112, updating provider code and SQL baselines to stay aligned with upstream query/type-mapping changes in the PostgreSQL provider.

Changes:

  • Bumps the .NET SDK and EF/Microsoft.Extensions package versions needed for the new EF preview.
  • Adapts provider internals to upstream EF changes, including JSON path API renaming, = ANY(scalar_subquery) SQL generation, and binary-expression type-mapping handling.
  • Rewrites affected SQL baselines across functional tests to match EF’s cast simplification behavior and new byte-array translation coverage.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsNpgsqlTest.csUpdates DateOnly SQL baselines after cast simplification.
test/EFCore.PG.FunctionalTests/Query/Translations/NodaTime/InstantTranslationsTest.csRemoves redundant timestamptz cast from expected SQL.
test/EFCore.PG.FunctionalTests/Query/Translations/MiscellaneousTranslationsNpgsqlTest.csRefreshes Convert.ToInt32 SQL baselines and formatting.
test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.csUpdates Sign SQL baselines after cast removal.
test/EFCore.PG.FunctionalTests/Query/Translations/CitextTranslationsTest.csRemoves redundant citext casts from expected SQL.
test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.csUpdates byte-array SQL baseline and overrides new upstream Any() test.
test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.csAdjusts primitive collection SQL baseline for parameter typing.
test/EFCore.PG.FunctionalTests/Query/NorthwindSqlQueryNpgsqlTest.csRemoves redundant casts in composed raw-SQL baseline.
test/EFCore.PG.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryNpgsqlTest.csRefreshes timestamp truncation baseline.
test/EFCore.PG.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryNpgsqlTest.csRefreshes timestamp truncation baseline.
test/EFCore.PG.FunctionalTests/Query/GearsOfWarQueryNpgsqlTest.csRefreshes timestamp truncation baseline.
src/EFCore.PG/Update/Internal/NpgsqlUpdateSqlGenerator.csAdapts to EF JSON path API rename from Ordinals to Indices.
src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.csPreserves explicit result type mappings for heterogeneous binary expressions.
src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.csEmits explicit array casts for ANY over scalar subqueries during SQL generation.
src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.csStops modeling scalar-subquery ANY disambiguation as a removable convert node.
src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.csFixes DateInterval.End translation to carry the correct intermediate result mapping.
global.jsonBumps the SDK to the matching preview.
Directory.Packages.propsUpdates central package versions and adds explicit Microsoft.Extensions pins.
Directory.Build.propsEnables central transitive package pinning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roji
roji merged commit 4f0ff60 into mainMay 4, 2026
4 of 13 checks passed
@roji
roji deleted the sync-ef-26251 branch May 4, 2026 14:33
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@roji