Skip to content

Index names that differ only in case pass the name checks and fail at apply on SQL Server and SQLite #116

Closed

Description

@CaffeinatedCoder

Problem

The core's index-name checks (ValidateUniqueIndexNames, ValidateNoNativeIndexNameCollision) compare names ordinally. SQL Server, under its default case-insensitive collation, and SQLite, whose identifiers are case-insensitive even when quoted, treat ix_case and IX_CASE as one name. Two complex indexes on one table named that way pass migrations add:

b.HasComplexIndex(x => x.Contact.Phone, indexName: "ix_case");
b.HasComplexIndex(x => x.Contact.Email, indexName: "IX_CASE");

and the migration fails at apply on SQL Server 2022:

The operation failed because an index or statistics with name 'IX_CASE' already exists on table 'customers'.

Confirmed by a probe test on the SQL Server integration lane (#100), run on a throwaway branch. A complex index named like a native HasIndex in another case has the same shape, through ValidateNoNativeIndexNameCollision. Loud: it fails at apply, never silently.

The key-name check added for #90 already compares without regard to case. PostgreSQL is unaffected: EF quotes identifiers, and quoted identifiers are case-sensitive there.

Fix

Make case sensitivity part of the provider's name rule beside IndexNameScope. Compare case-insensitively on SQL Server and in the core default (SQLite), and keep ordinal comparison on PostgreSQL. Add a lane row on SQL Server.

Found while building the SQL Server lane for #100 (stream C of 5.5.0).

Activity

  1. added this to the 5.5.0 milestone on Oct 20, 2026
  2. added
    bug
    severity/low
    package/core
    package/sqlserver
    area/indexes
    on Oct 20, 2026
  3. added
    breaking
    on Oct 20, 2026
  4. added a commit that references this issue on Oct 20, 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/indexesbreakingbugpackage/corepackage/sqlserverseverity/low

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions