Skip to content

A 5.x snapshot with an empty exclusion list on a TPC root is refused as holding constraints #171

Done

Description

@CaffeinatedCoder

Found by the pre-tag review of 948496a..0ee827d (the review for v11.0.0-preview.1). The file itself is not in that range.

ComplexIndexes5xExclusionReader (src/CodoMetis.EFCore.SchemaKit.PostgreSQL/Legacy/Internal/ComplexIndexes5xExclusionReader.cs:46-55) refuses a TPC root before it parses the list. A snapshot whose CustomExclusion:Constraints on the root of a TPC hierarchy is "[]" is refused with "holds exclusion constraints from EFCore.ComplexIndexes 5.x on Vehicle, the root of a TPC hierarchy", although it holds none. The kernel's own guard treats "[]" as nothing (LegacyFormats.HoldsSomething), as it treats "", and the reader accepts "".

Reproduction (test/…PostgreSQL.Tests/Legacy/, on 0ee827d): LegacyFixture.DiffFrom<MovedModels.SlotAlone> from a source with Entity<Vehicle>().UseTpcMappingStrategy().HasAnnotation("CustomExclusion:Constraints", json) passes for "" and throws for "[]".

No published 5.x writes "[]" for this annotation, as far as its source shows: NpgsqlExclusionMutableExtensions rewrites the list only when it amended an entry, and there is no removal. So only a snapshot edited by hand reaches it, and the failure is loud.

Fix: check for a TPC root only once the list is known to hold an entry, as HoldsSomething does.

Does it block preview.1?

No. It needs a hand-edited snapshot, and it refuses rather than misreading.

Activity

  1. added this to the 11.0.0 milestone on Nov 17, 2026
  2. added
    bug
    severity/low
    package/postgresql
    area/constraints
    on Nov 17, 2026
  3. CaffeinatedCoder commented on Nov 25, 2026

    @CaffeinatedCoder
    OwnerAuthor

    2026-11-25: fixed on the branch fix/172-171-tidy. The reader looks at the mapping strategy only once the list holds an entry. Since #189 the refusal was for a snapshot from before 5.5.0 alone; an empty list is read as no constraint in a snapshot of any version. A_constraint_on_the_root_of_a_TPC_hierarchy_is_read_from_the_version_that_made_copies holds "[]" and "", and fails with the check for an empty list taken out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/constraintsbugpackage/postgresqlseverity/low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions