Skip to content

Cloning NodaTime Interval multirange mapping changes NpgsqlDbType to DateMultirange #4018

Closed

Description

@roji

Description

Cloning the NodaTime Interval[] multirange mapping changes its NpgsqlDbType from TimestampTzMultirange to DateMultirange, even though its store type remains tstzmultirange. Parameters created from the cloned mapping will therefore receive the wrong PostgreSQL type.

Minimal repro

Run this as a .NET 11 console application referencing src/EFCore.PG.NodaTime/EFCore.PG.NodaTime.csproj from this repository. No PostgreSQL server is required.

using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal;
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;

var mapping = new IntervalMultirangeMapping(
    typeof(Interval[]), new IntervalRangeMapping());
var clone = (NpgsqlTypeMapping)mapping.WithStoreTypeAndSize(
    "tstzmultirange", null);

Console.WriteLine(mapping.NpgsqlDbType);
Console.WriteLine(clone.NpgsqlDbType);

Actual behavior

TimestampTzMultirange
DateMultirange

Expected behavior

Both mappings should use TimestampTzMultirange.

Cause

The cloning constructor in IntervalMultirangeMapping calls base(parameters, NpgsqlDbType.DateMultirange) rather than retaining the timestamp-with-time-zone multirange type used by the original constructor.

Environment

Confirmed against main at d98928a7, using .NET SDK 11.0.100-rc.2.26504.105 and EF Core 11.0.0-rc.2.26504.105. Discovered while auditing date/time formatting for #3532; this is independent of BCE formatting.

Activity

  1. added theissue type on Oct 18, 2026
  2. self-assigned this
    on Oct 18, 2026
  3. added this to the 10.0.4 milestone on Oct 18, 2026
  4. added a commit that references this issue on Oct 18, 2026
    b038505
  5. added 2 commits that reference this issue on Oct 18, 2026
    92d483c
    bb449e9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions