Changeset: a7a103869a09 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/a7a103869a09 Modified Files: clients/odbc/driver/SQLStatistics.c Branch: Jan2022 Log Message:
Some fixes to the query implementing the SQLStatistics function. This fixes bug #7215. diffs (22 lines): diff --git a/clients/odbc/driver/SQLStatistics.c b/clients/odbc/driver/SQLStatistics.c --- a/clients/odbc/driver/SQLStatistics.c +++ b/clients/odbc/driver/SQLStatistics.c @@ -192,7 +192,7 @@ MNDBStatistics(ODBCStmt *stmt, "i.name as index_name, " "case i.type when 0 then cast(%d as smallint) " "else cast(%d as smallint) end as type, " - "cast(kc.nr as smallint) as ordinal_position, " + "cast(kc.nr + 1 as smallint) as ordinal_position, " "c.name as column_name, " "cast(null as char(1)) as asc_or_desc, " "cast(null as integer) as cardinality, " @@ -209,7 +209,8 @@ MNDBStatistics(ODBCStmt *stmt, "i.id = kc.id and " "t.id = c.table_id and " "kc.name = c.name and " - "(k.type is null or k.type = 1)", + "k.name = i.name and " + "k.type in (0, 1)", stmt->Dbc->dbname, SQL_INDEX_HASHED, SQL_INDEX_OTHER); assert(pos < 1000); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list