-
Notifications
You must be signed in to change notification settings - Fork 614
[JDBC-V2] Review database metadata #2677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other comments (1)
- jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataTest.java (169-169) There's an indentation issue with the `getExtraNameCharacters()` assertion on line 169. It has extra indentation compared to surrounding lines.
💡 To request another review, post a new comment with "/windsurf-review".
| @Override | ||
| public boolean supportsDifferentTableCorrelationNames() throws SQLException { | ||
| return false; | ||
| return true; // no support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method supportsDifferentTableCorrelationNames() returns true with a comment saying "no support", which is contradictory. If ClickHouse doesn't support different table correlation names, this method should return false.
| @Override | ||
| public boolean supportsExpressionsInOrderBy() throws SQLException { | ||
| return true; | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The supportsExpressionsInOrderBy() method returns false, but ClickHouse does support expressions in ORDER BY clauses (e.g., ORDER BY column + 1). This should return true.
| @Override | ||
| public boolean nullsAreSortedLow() throws SQLException { | ||
| return !nullsAreSortedHigh(); // opposite of nullsAreSortedHigh | ||
| return true; // opposite of nullsAreSortedHigh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment for nullsAreSortedLow() says it's the "opposite of nullsAreSortedHigh", but the implementation now directly returns true without referencing nullsAreSortedHigh(). Either update the comment or make the implementation reflect this relationship.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the JDBC database metadata implementation to reflect ClickHouse's actual capabilities and limitations. The changes ensure that metadata queries return accurate information about what ClickHouse supports, particularly around SQL grammar, identifiers, transactions, and various database features.
Key changes:
- Updated max value constants to match ClickHouse's actual limitations and guardrails
- Corrected support flags for identifiers, transactions, and SQL grammar features
- Added comprehensive test coverage for metadata support flags and table types
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataTest.java | Added comprehensive tests for database metadata support flags and table type verification |
| jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java | Updated metadata methods to return accurate values for ClickHouse capabilities, added TableType enum, and improved documentation with inline comments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assertEquals(dbmd.storesUpperCaseQuotedIdentifiers(), false); | ||
| assertEquals(dbmd.storesMixedCaseQuotedIdentifiers(), false); | ||
| assertEquals(dbmd.nullPlusNonNullIsNull(), true); | ||
| assertEquals(dbmd.supportsConvert(), false); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assertion is a duplicate of line 173. Consider removing this redundant check.
| assertEquals(dbmd.supportsConvert(), false); |
|
|
||
| for (int type : new int[] {ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE} ) { | ||
| assertFalse(dbmd.supportsResultSetType(type)); | ||
| assertFalse(dbmd.supportsResultSetType(type)); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 289 is a duplicate of line 288. Remove the redundant assertion.
| assertFalse(dbmd.supportsResultSetType(type)); |
| @Override | ||
| public boolean supportsDifferentTableCorrelationNames() throws SQLException { | ||
| return false; | ||
| return true; // no support |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment 'no support' contradicts the return value true. Based on the method name supportsDifferentTableCorrelationNames, the comment should clarify what is actually supported (e.g., 'supports different table aliases').
| return true; // no support | |
| return true; // supports different table aliases |


Summary
Closes #2520
Closes #778
Closes #2519
Checklist
Delete items not relevant to your PR: