Skip to content

A column type change that begins the need for btree_gist fails to apply, and a test pins it as right #81

Closed

Description

@CaffeinatedCoder

Found by the analysis of #77 and #79, reproduced on PostgreSQL 16.15 and 18.6.

What happens

The planner ensures an extension for what a migration creates (#78). A column whose type changes creates nothing, since the contributor answers Unaffected, but PostgreSQL rebuilds the constraint's index under the new type, and that needs the operator class.

Reproduction

A constraint with = on a string column mapped to ltree, on a database without btree_gist. The target maps the column to text. The migration is EF Core's operations alone and fails at apply: 42704: data type text has no default operator class for access method "gist".

A_type_change_that_ends_the_need_for_the_extension_leaves_the_constraint_alone asserts no statement of SchemaKit's in that direction too, so it pins a migration that cannot apply. No live test runs the pair.

Loud, not silent.

Fix

Ensure the extensions of a target object that one of EF Core's changes touches, not only of those created.

Tests

Live, in both directions, on a database without the extension. The offline test expects the statement in the direction that begins the need.

Activity

  1. added this to the 11.0.0 milestone on Nov 12, 2026
  2. added
    bug
    package/core
    package/postgresql
    on Nov 12, 2026
  3. added
    area/constraints
    severity/medium
    area/migrations
    on Nov 12, 2026
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/constraintsarea/migrationsbugpackage/corepackage/postgresqlseverity/medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions