Skip to content

Sync to EF 11.0.0-preview.5.26251.112#3827

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

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

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented May 4, 2026

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

EF-side PRs that required changes

PR Change Impact
#38156 Strip no-op SQL CASTs 22 SQL baseline rewrites + 2 type mapping bug fixes (see below)
#38188 Rename StructuredJsonPath.OrdinalsIndices Build fix in NpgsqlUpdateSqlGenerator
#38168 Translate Any() over byte array Added 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.

Copilot AI review requested due to automatic review settings May 4, 2026 10:36
Copy link
Copy Markdown

Copilot AI left a comment

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
File Description
test/EFCore.PG.FunctionalTests/Query/Translations/Temporal/DateOnlyTranslationsNpgsqlTest.cs Updates DateOnly SQL baselines after cast simplification.
test/EFCore.PG.FunctionalTests/Query/Translations/NodaTime/InstantTranslationsTest.cs Removes redundant timestamptz cast from expected SQL.
test/EFCore.PG.FunctionalTests/Query/Translations/MiscellaneousTranslationsNpgsqlTest.cs Refreshes Convert.ToInt32 SQL baselines and formatting.
test/EFCore.PG.FunctionalTests/Query/Translations/MathTranslationsNpgsqlTest.cs Updates Sign SQL baselines after cast removal.
test/EFCore.PG.FunctionalTests/Query/Translations/CitextTranslationsTest.cs Removes redundant citext casts from expected SQL.
test/EFCore.PG.FunctionalTests/Query/Translations/ByteArrayTranslationsNpgsqlTest.cs Updates byte-array SQL baseline and overrides new upstream Any() test.
test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs Adjusts primitive collection SQL baseline for parameter typing.
test/EFCore.PG.FunctionalTests/Query/NorthwindSqlQueryNpgsqlTest.cs Removes redundant casts in composed raw-SQL baseline.
test/EFCore.PG.FunctionalTests/Query/Inheritance/TPTGearsOfWarQueryNpgsqlTest.cs Refreshes timestamp truncation baseline.
test/EFCore.PG.FunctionalTests/Query/Inheritance/TPCGearsOfWarQueryNpgsqlTest.cs Refreshes timestamp truncation baseline.
test/EFCore.PG.FunctionalTests/Query/GearsOfWarQueryNpgsqlTest.cs Refreshes timestamp truncation baseline.
src/EFCore.PG/Update/Internal/NpgsqlUpdateSqlGenerator.cs Adapts to EF JSON path API rename from Ordinals to Indices.
src/EFCore.PG/Query/NpgsqlSqlExpressionFactory.cs Preserves explicit result type mappings for heterogeneous binary expressions.
src/EFCore.PG/Query/Internal/NpgsqlQuerySqlGenerator.cs Emits explicit array casts for ANY over scalar subqueries during SQL generation.
src/EFCore.PG/Query/Internal/NpgsqlQueryableMethodTranslatingExpressionVisitor.cs Stops modeling scalar-subquery ANY disambiguation as a removable convert node.
src/EFCore.PG.NodaTime/Query/Internal/NpgsqlNodaTimeMemberTranslatorPlugin.cs Fixes DateInterval.End translation to carry the correct intermediate result mapping.
global.json Bumps the SDK to the matching preview.
Directory.Packages.props Updates central package versions and adds explicit Microsoft.Extensions pins.
Directory.Build.props Enables central transitive package pinning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roji roji force-pushed the sync-ef-26251 branch from 814a1b3 to ea91c4c Compare May 4, 2026 10:44
@roji roji merged commit 4f0ff60 into main May 4, 2026
4 of 13 checks passed
@roji roji deleted the sync-ef-26251 branch May 4, 2026 14:33
Sign up for free to 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