ResultSetMetaData#getTableName return same table when multi tables in the sql
String sql = "select * from a,b"
PreparedStatement preparedStatement = conn.prepareStatement(sql);
ResultSet resultSet = preparedStatement.executeQuery();
ResultSetMetaData resultSetMetaData = preparedStatement.getMetaData();
for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
String bindTable = resultSetMetaData.getTableName(i);
}
resultSetMetaData.getTableName(i) only return String "a"
Thanks for the report @Sochene. ClickHouse does not provide enough metadata for a query, so the driver has to use SQL parser to extract table name, which apparently does not work for your case.
I thought about issuing an explain statement for each query, but it's probably not worthy due to it's poor performance.
Is this mandatory in your project? What's the user scenario?
This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!
The 0.9.0 parse handles the SQL from example. The only left problem is to fix column's table name.
Server doesn't return table information for a column. This is a technical limitation even when column is specified. It relates to RowBinary that is used to read data.