prestodb/presto · error · SemanticException

MISSING_CATALOG

MISSING_CATALOG

Error message

Catalog '%s' does not exist

What it means

CREATE MATERIALIZED VIEW targets a qualified name whose catalog does not exist. After deriving viewName via createQualifiedObjectName, the task verifies metadataResolver.catalogExists(viewName.getCatalogName()) and throws SemanticException MISSING_CATALOG when it fails.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/CreateMaterializedViewTask.java:99

    public CreateMaterializedViewTask(SqlParser sqlParser)
    {
        this.sqlParser = requireNonNull(sqlParser, "sqlParser is null");
    }

    @Override
    public String getName()
    {
        return "CREATE MATERIALIZED VIEW";
    }

    @Override
    public ListenableFuture<?> execute(CreateMaterializedView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
    {
        QualifiedObjectName viewName = createQualifiedObjectName(session, statement, statement.getName(), metadata);
        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);

        if (!metadataResolver.catalogExists(viewName.getCatalogName())) {
            throw new SemanticException(MISSING_CATALOG, "Catalog '%s' does not exist", viewName.getCatalogName());
        }

        if (!metadataResolver.schemaExists(viewName.getCatalogSchemaName())) {
            throw new SemanticException(MISSING_SCHEMA, statement, "Schema '%s' does not exist", viewName.getSchemaName());
        }

        Optional<TableHandle> viewHandle = metadataResolver.getTableHandle(viewName);
        if (viewHandle.isPresent()) {
            if (!statement.isNotExists()) {
                throw new SemanticException(MATERIALIZED_VIEW_ALREADY_EXISTS, statement, "Materialized view '%s' already exists", viewName);
            }
            return immediateFuture(null);
        }

        accessControl.checkCanCreateTable(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), viewName);
        accessControl.checkCanCreateView(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), viewName);

        Map<NodeRef<Parameter>, Expression> parameterLookup = parameterExtractor(statement, parameters);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Fix the catalog name in the statement (SHOW CATALOGS to list valid ones)
  2. Install/deploy the missing connector and its properties file in /etc/catalog on the coordinator, then restart or wait for reload
  3. Check environment: the catalog may exist in dev but not in the cluster you're targeting
  4. Verify the plugin jar is present and the catalog registered in server logs

Example fix

// before
CREATE MATERIALIZED VIEW hivemetastore.default.mv AS SELECT ...
// after
CREATE MATERIALIZED VIEW hive.default.mv AS SELECT ... -- catalog actually configured
Defensive patterns

Strategy: validation

Validate before calling

// verify catalog exists before DDL
Set<String> catalogs = fetch("SHOW CATALOGS");
if (!catalogs.contains(catalog)) {
    throw new IllegalArgumentException("Catalog not found: " + catalog);
}

Prevention

When it happens

Trigger: Running CREATE MATERIALIZED VIEW unknown_catalog.schema.name AS ... where the catalog name is mistyped or the connector/plugin is not deployed on the coordinator; catalog file missing from /etc/catalog so the catalog never registers.

Common situations: Typos in the catalog portion of the qualified name; environment drift where the catalog exists in dev but not prod; connector plugin not installed; catalog properties file misconfigured or removed after upgrade.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/8006bad52ba75c98. Report an issue: GitHub.