[JDBC-V2] Fix DatabaseMetadata to return empty ResultSet where expected#2534
Merged
[JDBC-V2] Fix DatabaseMetadata to return empty ResultSet where expected#2534
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes DatabaseMetadata methods to return empty ResultSets instead of single rows with default values, which improves compatibility with UI tools. The fix addresses an issue where UI tools were breaking due to unexpected data in metadata methods that should return empty datasets.
- Adds
LIMIT 0clause to metadata queries to ensure they return empty ResultSets - Updates corresponding tests to verify empty ResultSets are returned
- Improves comments to clarify why these methods should return empty datasets
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| DatabaseMetaDataImpl.java | Adds LIMIT 0 to metadata queries and improves comments about ClickHouse not supporting foreign keys |
| DatabaseMetaDataTest.java | Adds assertions to verify empty ResultSets and minor import reordering |
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
jdbc-v2/src/main/java/com/clickhouse/jdbc/metadata/DatabaseMetaDataImpl.java
Outdated
Show resolved
Hide resolved
Client V2 CoverageCoverage Report
Class Coverage
|
JDBC V2 CoverageCoverage Report
Class Coverage
|
|
JDBC V1 CoverageCoverage Report
Class Coverage
|
Client V1 CoverageCoverage Report
Class Coverage
|
mshustov
approved these changes
Aug 13, 2025
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
There are some method in metadata that should return empty dataset with specific structure. Previously a single row with default values was returned. This breaks UI tools because they use this data for further work.
Closes #2517
Checklist
Delete items not relevant to your PR: