From 29724fb6e757973c20e6671434735f805003f437 Mon Sep 17 00:00:00 2001 From: Ananya Garg Date: Mon, 15 Sep 2025 14:58:58 +0530 Subject: [PATCH] Fix NON_UNIQUE value inconsistency in DatabaseMetaData.getIndexInfo() --- .../microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java index bad2e5097f..438496a748 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java @@ -271,7 +271,7 @@ private void checkClosed() throws SQLServerException { private static final String INDEX_INFO_QUERY = "SELECT db_name() AS TABLE_CAT, " + "sch.name AS TABLE_SCHEM, " + "t.name AS TABLE_NAME, " + - "i.is_unique AS NON_UNIQUE, " + + "CASE WHEN i.is_unique = 1 THEN 0 ELSE 1 END AS NON_UNIQUE, " + "t.name AS INDEX_QUALIFIER, " + "i.name AS INDEX_NAME, " + "i.type AS TYPE, " + @@ -295,7 +295,7 @@ private void checkClosed() throws SQLServerException { private static final String INDEX_INFO_QUERY_DW = "SELECT db_name() AS TABLE_CAT, " + "sch.name AS TABLE_SCHEM, " + "t.name AS TABLE_NAME, " + - "i.is_unique AS NON_UNIQUE, " + + "CASE WHEN i.is_unique = 1 THEN 0 ELSE 1 END AS NON_UNIQUE, " + "t.name AS INDEX_QUALIFIER, " + "i.name AS INDEX_NAME, " + "i.type AS TYPE, " +