-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
What happens?
java.sql.DatabaseMetadata.getTables()
supports a catalog
argument (https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/DatabaseMetaData.html#getTables(java.lang.String,java.lang.String,java.lang.String,java.lang.String%5B%5D)). However, the implementation in org.duckdb.DuckDBDatabaseMetaData
(https://github.com/duckdb/duckdb/blob/master/tools/jdbc/src/main/java/org/duckdb/DuckDBDatabaseMetaData.java#L676) always throws when it is not null or empty:
if (catalog != null && !catalog.isEmpty()) {
throw new SQLException("Actual catalog argument is not supported, got " + catalog);
}
It could be that duckdb simply chooses not to support this, but then it is strange (inconsistent) that a method like org.duckdb.DuckDBDatabaseMetaData.getColumns
handles the catalog argument just like any other argument (i.e. it just uses it to filter and does not throw when not empty or null)
(BTW there is another issue with getColumns which is related but still different #6225)
To Reproduce
public static void test_get_tables_with_catalog() throws Exception {
Connection conn = DriverManager.getConnection("jdbc:duckdb:");
String catalog = conn.getCatalog();
DatabaseMetaData databaseMetaData = conn.getMetaData();
try {
databaseMetaData.getTables(catalog, null, "%", null);
}
catch (SQLException ex) {
assertFalse(ex.getMessage().startsWith("Actual catalog argument is not supported"));
}
}
OS:
Windows 10 Pro
DuckDB Version:
v0.6.2-dev2342
DuckDB Client:
DuckDBJ
Full Name:
Roland Bouman
Affiliation:
Just-Bi.nl (an EPAM company)
Have you tried this on the latest master
branch?
- I agree
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- I agree