prestodb/presto · error · SemanticException
MISSING_SCHEMA
MISSING_SCHEMA
Error message
Schema '%s' does not exist
What it means
MetadataManager.getSchemaProperties looks up the properties of a schema. Before resolving connector metadata it checks schemaExists; if the schema is absent in the target catalog it throws a SemanticException with MISSING_SCHEMA. This is the canonical 'schema does not exist' user error surfaced during DDL/SHOW operations on schema properties.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/metadata/MetadataManager.java:410
ImmutableSet.Builder<String> schemaNames = ImmutableSet.builder();
if (catalog.isPresent()) {
CatalogMetadata catalogMetadata = catalog.get();
ConnectorSession connectorSession = session.toConnectorSession(catalogMetadata.getConnectorId());
for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) {
ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId);
metadata.listSchemaNames(connectorSession).stream()
.map(schema -> normalizeIdentifier(session, connectorId.getCatalogName(), schema))
.forEach(schemaNames::add);
}
}
return ImmutableList.copyOf(schemaNames.build());
}
@Override
public Map<String, Object> getSchemaProperties(Session session, CatalogSchemaName schemaName)
{
if (!getMetadataResolver(session).schemaExists(schemaName)) {
throw new SemanticException(MISSING_SCHEMA, format("Schema '%s' does not exist", schemaName));
}
Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, transactionManager, schemaName.getCatalogName());
CatalogMetadata catalogMetadata = catalog.get();
ConnectorSession connectorSession = session.toConnectorSession(catalogMetadata.getConnectorId());
ConnectorMetadata metadata = catalogMetadata.getMetadataFor(catalogMetadata.getConnectorId());
return metadata.getSchemaProperties(connectorSession, schemaName);
}
@Override
public Optional<TableHandle> getTableHandleForStatisticsCollection(Session session, QualifiedObjectName table, Map<String, Object> analyzeProperties)
{
requireNonNull(table, "table is null");
Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, transactionManager, table.getCatalogName());
if (catalog.isPresent()) {
CatalogMetadata catalogMetadata = catalog.get();View on GitHub (pinned to 55bb57d202)
Solutions
- Verify the schema exists: SHOW SCHEMAS FROM <catalog> and check the exact name
- Qualify the schema with the correct catalog name
- Recreate the schema if it was dropped (CREATE SCHEMA)
- Check case/identifier quoting if the connector is case-sensitive
Example fix
// before SHOW CREATE SCHEMA mycat.myshema; -- typo // after SHOW SCHEMAS FROM mycat; -- then use the correct name SHOW CREATE SCHEMA mycat.myschema;
Defensive patterns
Strategy: validation
Validate before calling
if (!metadataManager.schemaExists(session, catalogSchemaName)) {
throw new IllegalArgumentException("Schema not found: " + catalogSchemaName);
}
// or via SQL: SHOW SCHEMAS FROM <catalog> first Try / catch
try { props = metadata.getSchemaProperties(session, schemaName); }
catch (SemanticException e) { if (MISSING_SCHEMA == e.getCode()) { /* create schema or correct the name */ } else throw e; } Prevention
- List schemas with SHOW SCHEMAS FROM <catalog> before operating on one
- Always qualify schema with its catalog name
- Watch for concurrent DROP SCHEMA jobs in shared environments
- Mind identifier case sensitivity per connector
When it happens
Trigger: Calling getSchemaProperties (or running statements that read schema properties) with a CatalogSchemaName whose schema does not exist in the given catalog — e.g. SHOW CREATE SCHEMA / ALTER SCHEMA ... on a misspelled or dropped schema.
Common situations: Typo in schema name; querying the wrong catalog (schema exists in another catalog); schema dropped concurrently by another job; case-sensitivity issues where the connector stores names differently.
Related errors
- ARROW_FLIGHT_METADATA_ERROR
- ARROW_FLIGHT_METADATA_ERROR
- MISSING_SCHEMA
- INVALID_TABLE_PROPERTY
- NOT_SUPPORTED
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/b8a0a4953bf25595.
Report an issue: GitHub.