prestodb/presto · error · SemanticException
MISSING_TABLE
MISSING_TABLE
Error message
Table '${tableName}' does not exist What it means
In visitShowGrants, when a table name is supplied to SHOW GRANTS, it is resolved to a QualifiedObjectName and must exist: the code accepts it only if it is a view or a table (getView or getTableHandle present). Otherwise a SemanticException MISSING_TABLE is thrown.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/rewrite/ShowQueriesRewrite.java:277
selectList(aliasedName("table_name", "Table")),
from(schema.getCatalogName(), TABLE_TABLES),
predicate,
ordering(ascending("table_name")));
}
@Override
protected Node visitShowGrants(ShowGrants showGrants, Void context)
{
String catalogName = session.getCatalog().orElse(null);
Optional<Expression> predicate = Optional.empty();
Optional<QualifiedName> tableName = showGrants.getTableName();
if (tableName.isPresent()) {
QualifiedObjectName qualifiedTableName = createQualifiedObjectName(session, showGrants, tableName.get(), metadata);
if (!metadataResolver.getView(qualifiedTableName).isPresent() &&
!metadataResolver.getTableHandle(qualifiedTableName).isPresent()) {
throw new SemanticException(MISSING_TABLE, showGrants, "Table '%s' does not exist", tableName);
}
catalogName = qualifiedTableName.getCatalogName();
accessControl.checkCanShowTablesMetadata(
session.getRequiredTransactionId(),
session.getIdentity(),
session.getAccessControlContext(),
new CatalogSchemaName(catalogName, qualifiedTableName.getSchemaName()));
predicate = Optional.of(combineConjuncts(
equal(identifier("table_schema"), new StringLiteral(qualifiedTableName.getSchemaName())),
equal(identifier("table_name"), new StringLiteral(qualifiedTableName.getObjectName()))));
}
else {
if (catalogName == null) {
throw new SemanticException(CATALOG_NOT_SPECIFIED, showGrants, "Catalog must be specified when session catalog is not set");
}View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the fully qualified table name and correct typos.
- Confirm the table/view exists: `SHOW TABLES FROM <catalog>.<schema>` or SELECT from information_schema.tables.
- Run SHOW GRANTS without the ON clause to list grants you can see and find the correct object name.
- Check you are connected to the intended catalog/environment.
Example fix
// before SHOW GRANTS ON hive.default.ording -- typo // after SHOW GRANTS ON hive.default.ordering
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the table or view exists before SHOW GRANTS ON
boolean exists = !client.execute(
"SELECT 1 FROM " + catalog + ".information_schema.tables " +
"WHERE table_schema = '" + schema + "' AND table_name = '" + table + "'").getRows().isEmpty();
if (!exists) throw new IllegalArgumentException("Table not found: " + qualifiedName); Try / catch
try {
session.execute("SHOW GRANTS ON " + fqn);
} catch (SemanticException e) {
if (e.getCode() == SemanticErrorCode.MISSING_TABLE) {
// verify object name or list visible grants
} else throw e;
} Prevention
- Resolve table names from information_schema before granting-related queries
- Use fully qualified three-part names (catalog.schema.table)
- Check you are pointed at the intended environment/catalog
- Handle dropped/renamed tables by refreshing metadata caches in tooling
When it happens
Trigger: Running `SHOW GRANTS ON <catalog>.<schema>.<table>` where the named object is neither an existing table nor an existing view in the metadata resolver.
Common situations: Typo in the table name; querying grants on a table in the wrong catalog; the table was dropped/renamed; permissions let the statement parse but the object is invisible in that catalog.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/c3423cd4f26d6cfc.
Report an issue: GitHub.