-
Notifications
You must be signed in to change notification settings - Fork 581
Adjust getIndexInfo to return an empty ResultSet instead of a null value #2315
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
Conversation
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 DatabaseMetaData.getIndexInfo to return an empty ResultSet instead of null, ensuring that JDBC calls do not unexpectedly receive a null value. It also renames the DatabaseMetaData class to DatabaseMetaDataImpl and updates its references, and adds a new integration test for the getIndexInfo behavior.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
jdbc-v2/src/test/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataTest.java | Updated test to reference DatabaseMetaDataImpl and assert an empty ResultSet for getIndexInfo |
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java | Renamed class from DatabaseMetaData and modified getIndexInfo to return an empty ResultSet using a SQL query |
jdbc-v2/src/main/java/com/clickhouse/jdbc/ConnectionImpl.java | Updated to import and reference DatabaseMetaDataImpl instead of the previous class |
|
@@ -1065,7 +1065,14 @@ private static String getDataTypeInfoSql() { | |||
|
|||
@Override | |||
public ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException { | |||
return null; | |||
try { | |||
String sql = "SELECT null AS TABLE_CAT, null AS TABLE_SCHEM, null AS TABLE_NAME, null AS NON_UNIQUE," + |
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.
I would expect that we use https://clickhouse.com/docs/sql-reference/statements/show#show-index to get information about indexes.
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.
LGTM
Summary
Closes #2286
Checklist
Delete items not relevant to your PR: