Mercurial > hg > monetdb-java
changeset 936:e9d65d746c80
When querying unique constraints metadata include new type 3 (= Unique Key With Nulls Not Distinct).
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Thu, 12 Dec 2024 19:00:34 +0100 (3 months ago) |
parents | 540d8b5944b1 |
children | d416e9b6b3d0 |
files | src/main/java/org/monetdb/util/MDBvalidator.java |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/util/MDBvalidator.java +++ b/src/main/java/org/monetdb/util/MDBvalidator.java @@ -278,7 +278,7 @@ public final class MDBvalidator { // fetch the primary or unique key info from the MonetDB system tables final StringBuilder sb = new StringBuilder(400); sb.append(" FROM sys.keys k JOIN sys.tables t ON k.table_id = t.id JOIN sys.schemas s ON t.schema_id = s.id" - + " WHERE k.\"type\" = ").append(pkey ? 0 : 1) // 0 = primary keys, 1 = unique keys + + " WHERE k.\"type\" ").append(pkey ? "= 0" : "IN (1,3)") // 0 = Primary Key, 1 = Unique Key, 3 = Unique Key With Nulls Not Distinct .append(" and s.name = '").append(schema).append('\''); String qry = sb.toString(); final int count = runCountQuery(qry); @@ -291,7 +291,7 @@ public final class MDBvalidator { // fetch the primary or unique key info including columns from the MonetDB system tables sb.append("SELECT s.name as sch_nm, t.name as tbl_nm, k.name as key_nm, o.name as col_nm, o.nr") .append(" FROM sys.keys k JOIN sys.objects o ON k.id = o.id JOIN sys.tables t ON k.table_id = t.id JOIN sys.schemas s ON t.schema_id = s.id" - + " WHERE k.\"type\" = ").append(pkey ? 0 : 1) // 0 = primary keys, 1 = unique keys + + " WHERE k.\"type\" ").append(pkey ? "= 0" : "IN (1,3)") // 0 = Primary Key, 1 = Unique Key, 3 = Unique Key With Nulls Not Distinct .append(" and s.name = '").append(schema).append('\'') .append(" ORDER BY t.name, k.name, o.nr;"); qry = sb.toString();