prestodb/presto · error · PrestoException

NOT_SUPPORTED

NOT_SUPPORTED

Error message

CASCADE is not yet supported for DROP SCHEMA

What it means

Thrown by DropSchemaTask.execute when DROP SCHEMA is issued with CASCADE. Presto's implementation only supports RESTRICT semantics for dropping schemas, so any cascade request fails immediately with NOT_SUPPORTED before any existence or permission checks.

Source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/DropSchemaTask.java:57

        implements DDLDefinitionTask<DropSchema>
{
    @Override
    public String getName()
    {
        return "DROP SCHEMA";
    }

    @Override
    public String explain(DropSchema statement, List<Expression> parameters)
    {
        return "DROP SCHEMA " + statement.getSchemaName();
    }

    @Override
    public ListenableFuture<?> execute(DropSchema statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)
    {
        if (statement.isCascade()) {
            throw new PrestoException(NOT_SUPPORTED, "CASCADE is not yet supported for DROP SCHEMA");
        }

        CatalogSchemaName schema = createCatalogSchemaName(session, statement, Optional.of(statement.getSchemaName()), metadata);
        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);

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

        if (!metadataResolver.schemaExists(schema)) {
            if (!statement.isExists()) {
                throw new SemanticException(MISSING_SCHEMA, statement, "Schema '%s' does not exist", schema);
            }
            return immediateFuture(null);
        }

        accessControl.checkCanDropSchema(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), schema);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Drop the schema's tables/views explicitly first, then run DROP SCHEMA without CASCADE.
  2. Generate a script of contained objects (query information_schema.tables/views) and drop each before the schema.
  3. Remove CASCADE from generated SQL or change ORM/tooling defaults to RESTRICT.

Example fix

// before
DROP SCHEMA catalog.db.tmp_schema CASCADE;
// after
DROP TABLE IF EXISTS catalog.db.tmp_schema.t1;
DROP VIEW IF EXISTS catalog.db.tmp_schema.v1;
DROP SCHEMA catalog.db.tmp_schema;
Defensive patterns

Strategy: validation

Validate before calling

// reject CASCADE before sending the statement
if (sql.toLowerCase().contains("drop schema") && sql.toLowerCase().contains("cascade")) {
  throw new IllegalArgumentException("CASCADE unsupported for DROP SCHEMA; drop children first");
}

Prevention

When it happens

Trigger: Statement.isCascade() is true, i.e. 'DROP SCHEMA schema_name CASCADE'.

Common situations: Porting SQL scripts from PostgreSQL/other engines where CASCADE is common; cleanup scripts that assume recursive drop; ORMs generating CASCADE by default.

Understand the failure class

Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.

Related errors


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