Skip to content

DatabaseMetaData.getIndexInfo() return wrong NON_UNIQUE value #2771

@fanste

Description

@fanste

Driver version

13.2.0.jre11

SQL Server version

Microsoft SQL Server 2017 (RTM-CU31-GDR) (KB5058714) - 14.0.3495.9 (X64) Jun 10 2025 16:22:03

Problem description

According to the docs, sp_statistics contains NON_UNIQUE with 1 = not unique and 0 = unique.
But sys.indexes contains is_unique with 1 = unique and 0 = not unique.

DatabaseMetaData.getIndexInfo() simply merges the results of both result without handling this difference.

This e.g. causes hibernate-tools to fail on reverse engineering the database model to entity classes, as the same index name may be unique and non-unique at the same time.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions