Implement ODBC catalog metadata - #671
Merged
Shfdis merged 5 commits intoSep 30, 2026
Merged
Conversation
Collaborator
Author
|
@codex review |
There was a problem hiding this comment.
AI Review Summary
Verdict: ✅ No critical issues found
Critical issues
No critical issues found.
Other findings
- Major | High: catalog metadata traversal no longer prunes to the pattern's literal prefix — every SQLTables/SQLColumns/SQLPrimaryKeys/SQLStatistics call recursively lists the entire database tree, even for exact-name lookups —
odbc/src/statement_metadata.cpp:659 - Minor | Medium: SQLTables special-value handling (SQL_ALL_CATALOGS / SQL_ALL_SCHEMAS / SQL_ALL_TABLE_TYPES) runs even when SQL_ATTR_METADATA_ID = SQL_TRUE, where those values are supposed to be treated as literal identifiers —
odbc/src/statement_metadata.cpp:388 - Minor | Medium: with SQL_ATTR_METADATA_ID = SQL_FALSE, catalog arguments no longer support pattern matching in SQLColumns/SQLTables (e.g. catalog "%" now yields an empty result set instead of the current catalog); only the fully-empty SQLTables combination handles SQL_ALL_CATALOGS —
odbc/src/statement_metadata.cpp:333 - Minor | Medium: table name patterns are matched against the absolute path, so patterns like "prefix%" or "%" miss tables located in subdirectories ("%" matches only the top level while a null argument enumerates everything) —
odbc/src/statement_metadata.cpp:663 - Minor | Low: CARDINALITY is silently reported as NULL for tables with more rows than INT32_MAX (Int32OrNull), losing the statistic instead of reporting a value —
odbc/src/statement_metadata.cpp:480 - Minor | Low: no test covers SQLStatistics with SQL_INDEX_ALL when both unique and non-unique indexes exist (ordering by NON_UNIQUE then INDEX_NAME), since the unique-index coverage only queries SQL_INDEX_UNIQUE —
odbc/tests/integration/metadata_api_it.cpp:666 - Nit | Low: the SQLTables result-set sort comparator allocates temporary strings (GetTableType/GetMetadataTableName) on every comparison —
odbc/src/statement_metadata.cpp:426 - Nit | Low: a trailing lone backslash in a LIKE pattern is treated as a literal backslash rather than an invalid/malformed escape —
odbc/src/utils/sql_like.h:30
This review was generated automatically. Critical issues require attention; other findings are advisory.
If this comment was useful, please give it a 👍 — it helps us improve the review bot.
|
Analysis performed by claude, z-ai/glm-5.3-flash. |
There was a problem hiding this comment.
AI Review Summary
Verdict: ✅ No critical issues found
Critical issues
No critical issues found.
Other findings
- Major | High:
SQLColumnspassescatalogPatternsAllowed=false, so catalog search patterns (e.g."%"or"loca%") are compared literally against the single catalog and return an empty result set instead of matching it — per ODBC, CatalogName is a pattern argument when SQL_ATTR_METADATA_ID=SQL_FALSE —odbc/src/statement_metadata.cpp:352 - Minor | Medium:
SQLStatisticsrejectsSQL_INDEX_HASHwithHY100; ODBC defines SQL_INDEX_HASH as a valid Unique value, and a driver without hash-index support should return an empty result set rather than an error —odbc/src/statement_metadata.cpp:468 - Minor | Medium:
SQLSpecialColumnswas not migrated to the new null/empty metadata-argument semantics: null pointers are silently converted to empty strings, so with SQL_ATTR_METADATA_ID=SQL_TRUE a null catalog/schema/table is not rejected with HY009 like the other catalog APIs, and an empty TableName now yields an empty result set instead of a list of candidates —odbc/src/statement_metadata.cpp:535 - Minor | Medium: the
SQL_ALL_TABLE_TYPESspecial enumeration is not gated onpatternsAllowed; with SQL_ATTR_METADATA_ID=SQL_TRUE (where"%"is documented as a literal identifier and the new HY009 rules apply) passing TableType="%"still returns the type list, inconsistent with the strict semantics introduced in this PR —odbc/src/statement_metadata.cpp:420 - Minor | Medium: no integration coverage for catalog arguments in
SQLColumns(e.g. catalog"%"with MetadataId=SQL_FALSE); such a test would have caught the catalog-pattern regression —odbc/tests/integration/metadata_api_it.cpp:568 - Minor | Low:
GetBufferLengthfalls back toGetColumnSizefor character types, reporting the character count instead of the byte length (spec: BUFFER_LENGTH is the size in bytes, including the terminator, needed to transfer the column) —odbc/src/statement_metadata.cpp:233 - Minor | Low: null and empty-string TableType are both treated as "match all types" (MatchesTableTypeFilter with an empty filter returns true); per ODBC an empty list of table types is distinct from a null pointer —
odbc/src/statement_metadata.cpp:443 - Nit | High: directory pruning builds a temporary
fullPath + "/"string for every visited node; comparing prefix bounds directly (e.g. viastd::string_view::starts_withon the parent path plus the separator length) avoids the allocation on large catalogs —odbc/src/statement_metadata.cpp:682
This review was generated automatically. Critical issues require attention; other findings are advisory.
If this comment was useful, please give it a 👍 — it helps us improve the review bot.
|
Analysis performed by claude, z-ai/glm-5.3-flash. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary