OtterMind/Chat2DB · error · IllegalArgumentException
Presto table name must not be blank
Error message
Presto table name must not be blank
What it means
Thrown by PrestoMetaData.buildShowCreateTableSql when the tableName parameter is null or blank (whitespace-only). This method constructs the SHOW CREATE TABLE SQL for Presto/Trino. A blank table name makes the SQL syntactically invalid, so it is rejected before execution. The check uses isBlank which tests for null or all-whitespace strings.
Source
Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-presto/src/main/java/ai/chat2db/plugin/presto/PrestoMetaData.java:27
public class PrestoMetaData extends DefaultMetaService implements IDbMetaData {
@Override
public String tableDDL(Connection connection, String databaseName, String schemaName, String tableName) {
ISQLIdentifierProcessor identifierProcessor = getSQLIdentifierProcessor();
String sql = buildShowCreateTableSql(identifierProcessor, databaseName, schemaName, tableName);
return DefaultSQLExecutor.getInstance().execute(connection, sql, resultSet -> {
if (resultSet.next()) {
return resultSet.getString(1);
}
return null;
});
}
static String buildShowCreateTableSql(ISQLIdentifierProcessor identifierProcessor, String catalogName,
String schemaName, String tableName) {
if (isBlank(tableName)) {
throw new IllegalArgumentException("Presto table name must not be blank");
}
boolean hasCatalog = !isBlank(catalogName);
boolean hasSchema = !isBlank(schemaName);
if (hasCatalog && !hasSchema) {
throw new IllegalArgumentException("Presto schema name is required when catalog name is provided");
}
StringBuilder qualifiedName = new StringBuilder();
if (hasCatalog) {
qualifiedName.append(identifierProcessor.quoteIdentifierAlways(catalogName)).append('.');
}
if (hasSchema) {
qualifiedName.append(identifierProcessor.quoteIdentifierAlways(schemaName)).append('.');
}
qualifiedName.append(identifierProcessor.quoteIdentifierAlways(tableName));
return "SHOW CREATE TABLE " + qualifiedName;
}View on GitHub (pinned to 5ee1e990e7)
Solutions
- Validate that tableName is non-blank before calling tableDDL
- Guard the UI so tableDDL is only invoked when a concrete table node is selected
- Return early or skip if tableName is null or blank at the call site
Example fix
// before
String ddl = metaData.tableDDL(conn, catalog, schema, "");
// after
if (tableName == null || tableName.isBlank()) {
throw new IllegalArgumentException("Table name required");
}
String ddl = metaData.tableDDL(conn, catalog, schema, tableName); Defensive patterns
Strategy: validation
Validate before calling
if (tableName == null || tableName.isBlank()) {
throw new IllegalArgumentException("Presto table name must not be blank");
}
String sql = PrestoMetaData.buildShowCreateTableSql(processor, catalog, schema, tableName); Prevention
- Validate tableName is non-blank before calling tableDDL
- Guard UI so tableDDL is only called when a concrete table is selected
- Return early in the controller or service if the table name is missing
When it happens
Trigger: Calling PrestoMetaData.tableDDL(connection, databaseName, schemaName, tableName) where tableName is null, empty, or contains only whitespace. The validation runs in buildShowCreateTableSql at line 26 before the SQL is sent to the connection.
Common situations: A UI selection event that fires before a table is fully selected; a null table name from a metadata tree node; programmatic callers passing an unvalidated identifier.
Related errors
- Presto schema name is required when catalog name is provided
- Redshift table name must not be empty
- Invalid generic {what}: {value}
- Unsafe column type name from metadata: {typeName}
- Unsafe H2 column default from metadata: {columnDefault}
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/d9a359c75496ab47.
Report an issue: GitHub.