Skip to content

Fix AdHocJsonQuery test failures on hotfix/9.0.5#3818

Merged
roji merged 1 commit intohotfix/9.0.5from
roji/fix-backport-ci-failure
Apr 26, 2026
Merged

Fix AdHocJsonQuery test failures on hotfix/9.0.5#3818
roji merged 1 commit intohotfix/9.0.5from
roji/fix-backport-ci-failure

Conversation

@roji
Copy link
Copy Markdown
Member

@roji roji commented Apr 26, 2026

EF Core 9.0.14 added AdHocJsonQueryTestBase tests (region #21006) that seed DateTime values with DateTimeKind.Unspecified. Npgsql's NpgsqlTimestampTzTypeMapping throws ArgumentException for non-default Unspecified DateTimes during JSON serialization. These tests were never CI-tested on the hotfix branch because the dependency bump commit was pushed as part of the release process without triggering CI.

This overrides Seed21006 in AdHocJsonQueryNpgsqlTest to:

  1. Create entity 1 with DateTimeKind.Utc (so SaveChangesAsync() succeeds)
  2. Insert entities 2-6 via raw SQL with UTC timestamps (matching the pattern used by SQL Server's test class)

EF Core 9.0.14 added AdHocJsonQueryTestBase tests (region #21006) that
seed DateTime values with DateTimeKind.Unspecified. Npgsql's
NpgsqlTimestampTzTypeMapping throws for non-default Unspecified
DateTimes during JSON serialization.

Override Seed21006 in AdHocJsonQueryNpgsqlTest to use UTC DateTimes for
entity 1 and insert entities 2-6 via raw SQL (matching the pattern used
by SQL Server's test class).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 26, 2026 13:24
@roji roji changed the base branch from main to hotfix/9.0.5 April 26, 2026 13:25
@roji roji merged commit 82f06b2 into hotfix/9.0.5 Apr 26, 2026
7 checks passed
@roji roji deleted the roji/fix-backport-ci-failure branch April 26, 2026 13:31
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

Fixes regressions and test failures introduced after updating the hotfix branch to EF Core 9.0.14 / Npgsql 9.0.5, including provider behavior changes around JSON DateTime seeding, enum/type mapping, migrations SQL generation, and various query translation baselines.

Changes:

  • Override AdHoc JSON test seeding to avoid DateTimeKind.Unspecified serialization failures by using UTC and raw SQL inserts.
  • Add/update provider behavior for data source configuration, value generation, enum/type parsing, array conversion, migrations SQL generation, and query translations; refresh corresponding unit/functional test baselines.
  • Update SDK/package versions and CI workflow configuration for the hotfix branch.

Reviewed changes

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

Show a summary per file
File Description
test/EFCore.PG.Tests/Storage/NpgsqlTypeMappingSourceTest.cs Adds coverage for store type name parsing behavior.
test/EFCore.PG.Tests/NpgsqlValueGeneratorSelectorTest.cs Updates expected generator types for string value generation.
test/EFCore.PG.Tests/NpgsqlRelationalConnectionTest.cs Adds test coverage for configuring a data source without a connection string.
test/EFCore.PG.Tests/NpgsqlDbContextOptionsExtensionsTest.cs Adds regression test around service provider reuse with varying data source connection strings.
test/EFCore.PG.FunctionalTests/Query/PrimitiveCollectionsQueryNpgsqlTest.cs Adds SQL baseline for ImmutableArray parameter Contains translation.
test/EFCore.PG.FunctionalTests/Query/EnumQueryTest.cs Adds uppercase-named enum mapping and related query baseline.
test/EFCore.PG.FunctionalTests/Query/ArrayListQueryTest.cs Updates SQL baseline for array_position nullability handling.
test/EFCore.PG.FunctionalTests/Query/ArrayArrayQueryTest.cs Updates SQL baseline for array_position nullability handling.
test/EFCore.PG.FunctionalTests/Query/AdHocJsonQueryNpgsqlTest.cs Overrides seeding to use UTC DateTimes and raw SQL inserts to match EF tests.
test/EFCore.PG.FunctionalTests/NpgsqlDatabaseCreatorTest.cs Adjusts test subclass constructor signature for DatabaseCreator changes.
test/EFCore.PG.FunctionalTests/Migrations/MigrationsNpgsqlTest.cs Adds/updates migration tests for collation preservation and enum label ordering behavior.
test/EFCore.PG.FunctionalTests/Migrations/MigrationsInfrastructureNpgsqlTest.cs Updates overrides/conditions to match upstream behavior and PG version requirements.
test/EFCore.PG.FunctionalTests/BadDataJsonDeserializationNpgsqlTest.cs Fixes test class naming for Npgsql provider.
src/EFCore.PG/ValueGeneration/NpgsqlSequentialStringValueGenerator.cs Introduces sequential string value generator based on sequential GUIDs.
src/EFCore.PG/ValueGeneration/Internal/NpgsqlValueGeneratorSelector.cs Selects sequential value generators for Guid and string under specific conditions.
src/EFCore.PG/Utilities/Util.cs Extends cached boolean arrays used for nullability propagation metadata.
src/EFCore.PG/Storage/ValueConversion/NpgsqlArrayConverter.cs Refactors array conversion expression building and null-handling.
src/EFCore.PG/Storage/Internal/NpgsqlTypeMappingSource.cs Adds store type parsing helper and adjusts enum mapping resolution to support quoted names.
src/EFCore.PG/Storage/Internal/NpgsqlDatabaseCreator.cs Refactors Exists/ExistsAsync and ensures connections close via finally during type reload.
src/EFCore.PG/Storage/Internal/NpgsqlDataSourceManager.cs Changes when a data source is created and allows ConfigureDataSource without connection string.
src/EFCore.PG/Query/Internal/NpgsqlParameterBasedSqlProcessorFactory.cs Makes factory Create method virtual for extensibility.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlByteArrayMethodTranslator.cs Adds translation for Enumerable.Any() over bytea-mapped columns.
src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlArrayMethodTranslator.cs Fixes nullability propagation metadata for array_position.
src/EFCore.PG/Migrations/NpgsqlMigrationsSqlGenerator.cs Adjusts ALTER COLUMN collation generation and enum label add-ordering logic.
src/EFCore.PG/Migrations/Internal/NpgsqlMigrator.cs Ensures connection closure via finally during ReloadTypes.
src/EFCore.PG/Metadata/Conventions/NpgsqlSharedTableConvention.cs Sets uniqueness behavior flags for shared-table conventions.
src/EFCore.PG/Internal/EnumerableMethods.cs Restores AnyWithoutPredicate method info lookup.
src/EFCore.PG/Infrastructure/Internal/NpgsqlOptionsExtension.cs Copies DataSourceBuilderAction and changes service provider hash behavior for data source config.
global.json Pins SDK version and adjusts rollForward behavior.
EFCore.PG.sln.DotSettings Adds “timestamptz” to the user dictionary.
Directory.Packages.props Updates EF Core / Npgsql and test/tooling package versions.
Directory.Build.props Updates version prefix, warning suppressions, and copyright year.
.gitignore Ignores *.lscache files.
.github/workflows/trigger-doc-build.yml Adds minimal permissions block.
.github/workflows/codeql-analysis.yml Removes CodeQL workflow.
.github/workflows/build.yml Adjusts permissions, PG matrix versions, and NuGet publishing auth flow; modifies SDK setup usage.

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