prestodb/presto · error · SemanticException

MISSING_VIEW

MISSING_VIEW

Error message

View '%s' does not exist

What it means

SemanticException (MISSING_VIEW) raised at the start of ALTER VIEW ... RENAME: the metadata resolver has no view definition for the fully qualified source name. With IF EXISTS the rename is silently skipped instead.

Solutions

  1. Verify the view name and its catalog/schema qualification with SHOW VIEWS
  2. Append IF EXISTS if a no-op on missing view is desired
  3. Create the view before attempting to rename it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameViewTask.java:54

import static com.google.common.util.concurrent.Futures.immediateFuture;

public class RenameViewTask
        implements DDLDefinitionTask<RenameView>
{
    @Override
    public String getName()
    {
        return "RENAME VIEW";
    }

    public ListenableFuture<?> execute(RenameView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
    {
        QualifiedObjectName viewName = createQualifiedObjectName(session, statement, statement.getSource(), metadata);

        Optional<ViewDefinition> view = metadata.getMetadataResolver(session).getView(viewName);
        if (!view.isPresent()) {
            if (!statement.isExists()) {
                throw new SemanticException(MISSING_VIEW, statement, "View '%s' does not exist", viewName);
            }
            return immediateFuture(null);
        }

        QualifiedObjectName target = createQualifiedObjectName(session, statement, statement.getTarget(), metadata);
        if (!metadata.getCatalogHandle(session, target.getCatalogName()).isPresent()) {
            throw new SemanticException(MISSING_CATALOG, statement, "Target catalog '%s' does not exist", target.getCatalogName());
        }
        if (metadata.getMetadataResolver(session).getView(target).isPresent()) {
            throw new SemanticException(VIEW_ALREADY_EXISTS, statement, "Target view '%s' already exists", target);
        }
        if (!viewName.getSchemaName().equals(target.getSchemaName())) {
            throw new SemanticException(NOT_SUPPORTED, statement, "View rename across schemas is not supported");
        }
        if (!viewName.getCatalogName().equals(target.getCatalogName())) {
            throw new SemanticException(NOT_SUPPORTED, statement, "View rename across catalogs is not supported");
        }

View on GitHub (pinned to 55bb57d202)