prestodb/presto · error · SemanticException
MISSING_TABLE
MISSING_TABLE
Error message
Table %s does not exist
What it means
Final fallback in MetadataUtils.getTableColumnMetadata: when catalog and schema both exist but the resolver still returns no TableHandle, it throws SemanticException MISSING_TABLE naming the full table. The connector can see the namespace but no table with that name.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/util/MetadataUtils.java:92
return session.getRuntimeStats().recordWallTime(
GET_MATERIALIZED_VIEW_TIME_NANOS,
() -> metadataResolver.getMaterializedView(viewName));
}
public static TableColumnMetadata getTableColumnMetadata(Session session, MetadataResolver metadataResolver, QualifiedObjectName tableName)
{
Optional<TableHandle> tableHandle = session.getRuntimeStats().recordWallTime(
GET_TABLE_HANDLE_TIME_NANOS,
() -> metadataResolver.getTableHandle(tableName));
if (!tableHandle.isPresent()) {
if (!metadataResolver.catalogExists(tableName.getCatalogName())) {
throw new SemanticException(MISSING_CATALOG, "Catalog %s does not exist", tableName.getCatalogName());
}
if (!metadataResolver.schemaExists(new CatalogSchemaName(tableName.getCatalogName(), tableName.getSchemaName()))) {
throw new SemanticException(MISSING_SCHEMA, "Schema %s does not exist", tableName.getSchemaName());
}
throw new SemanticException(MISSING_TABLE, "Table %s does not exist", tableName);
}
Map<String, ColumnHandle> columnHandles = session.getRuntimeStats().recordWallTime(
GET_COLUMN_HANDLE_TIME_NANOS,
() -> metadataResolver.getColumnHandles(tableHandle.get()));
List<ColumnMetadata> columnsMetadata = session.getRuntimeStats().recordWallTime(
GET_COLUMN_METADATA_TIME_NANOS,
() -> metadataResolver.getColumns(tableHandle.get()));
return new TableColumnMetadata(tableHandle, columnHandles, columnsMetadata);
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Run SHOW TABLES FROM <catalog>.<schema> to confirm the exact table name
- Create the table if missing (CREATE TABLE ... AS ...) or fix the name
- Check privileges/visibility rules if the table should exist
- Verify the underlying metastore/connector actually contains the table
Example fix
// before SELECT * FROM postgresql.public.ordre; -- typo // after SELECT * FROM postgresql.public.orders;
Defensive patterns
Strategy: try-catch
Validate before calling
// Check table existence before fetching column metadata
if (!metadata.listTables(session, schemaName).stream()
.anyMatch(t -> t.getTableName().equalsIgnoreCase(tableName))) {
throw new IllegalArgumentException("Unknown table: " + tableName);
} Try / catch
try {
columns = MetadataUtils.getTableColumnMetadata(...);
} catch (SemanticException e) {
if (e.getCode() == MISSING_TABLE) {
throw new UserError("Table not found: " + e.getMessage());
}
throw e;
} Prevention
- Run SHOW TABLES FROM <catalog>.<schema> to confirm names
- Handle table drops/renames with migration-aware retries (once)
- Check connector privileges if tables seem to disappear
- Track DDL changes that could invalidate referenced table names
When it happens
Trigger: SELECT/DESCRIBE/SHOW COLUMNS on catalog.schema.table where the table name is wrong or the table was dropped; permission-filtered visibility making the table appear nonexistent; a connector that lazily lists metadata not seeing the table.
Common situations: Typo in table name; table dropped or renamed by another job; stale assumptions after redeployments; connector metastore lag (e.g. Hive metastore eventual issues); insufficient privileges masking the table.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/fd1c60064bf30be2.
Report an issue: GitHub.