Skip to content

Bug Report: schemadiff: will not drop a duplicate FK/CHECK constraint in ConstraintNamesIgnoreAll|ConstraintNamesIgnoreVitess #14386

@shlomi-noach

Description

@shlomi-noach

Overview of the Issue

Given these two tables:

create table t1 (id int primary key, i int, constraint `chk1` CHECK ((`i` > 2)), constraint `chk2` CHECK ((`i` > 2)));

create table t2 (id int primary key, i int, constraint `chk1` CHECK ((`i` > 2)));

Diffing the two, we expect to see a diff of

DROP CONSTRAINT `chk2`

However, with DiffHints.ConstraintNamesStrategy being ConstraintNamesIgnoreAll or ConstraintNamesIgnoreVitess, it's possible to get an empty diff. Specifically, using ConstraintNamesIgnoreAll on the above leads to an empty diff.

schemadiff should identify the scenario where there's two different constraints, even if it ignores their names.

Reproduction Steps

Binary Version

18, 17, 16

Operating System and Environment details

-

Log Fragments

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions