JDBC driver DatabaseMetadata.getColumns returns empty result set when pattern is specified for table name
mainstreet439 opened this issue · 2 comments
originally noted at https://community.mapd.com/t/jdbc-driver-databasemetadata-getcolumns-returns-empty-result-set-when-pattern-is-specified/925
MAPD version 3.3.1-20171108-32e7bcc
Calling DatabaseMetadata.getColumns passing a pattern character for the table name returns an empty ResultSet. Meanwhile patterns in the column name will work.
Logic to check tablename is incorrect (if ((tableNamePattern == null) || (tableNamePattern.equals(tableName)))) vs column name check if ((columnNamePattern == null) || (value.col_name.matches(modifiedColumnPattern)))
Returns 0 rows
ResultSet columns = dbMeta.getColumns( null, null, “%”, “%”);
ResultSet columns = dbMeta.getColumns( null, null, “T%”, “%”);
ResultSet columns = dbMeta.getColumns( null, null, "TLJA\_JP", "%");
Returns rows of table
ResultSet columns = dbMeta.getColumns( null, null, “TABLE1”, “%”);
Note related enhancement heavyai/heavydb#138. Good functional question is whether to also allow SQL-style pattern match in addition to or instead of regex. @niviksha
@billmaimone - applications written to the JDBC specification would expect to be able to use
the meta characters defined in the API spec.
https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html