{"record":{"id":"7521fddf2fcd4fd6","repo":"prestodb/presto","slug":"missing-schema-7521fd","errorCode":"MISSING_SCHEMA","errorMessage":"Schema '%s' does not exist","messagePattern":"Schema '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/DropSchemaTask.java","lineNumber":69,"sourceCode":"    }\n\n    @Override\n    public ListenableFuture<?> execute(DropSchema statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        if (statement.isCascade()) {\n            throw new PrestoException(NOT_SUPPORTED, \"CASCADE is not yet supported for DROP SCHEMA\");\n        }\n\n        CatalogSchemaName schema = createCatalogSchemaName(session, statement, Optional.of(statement.getSchemaName()), metadata);\n        MetadataResolver metadataResolver = metadata.getMetadataResolver(session);\n\n        if (!metadataResolver.catalogExists(schema.getCatalogName())) {\n            throw new SemanticException(MISSING_CATALOG, \"Catalog '%s' does not exist\", schema.getCatalogName());\n        }\n\n        if (!metadataResolver.schemaExists(schema)) {\n            if (!statement.isExists()) {\n                throw new SemanticException(MISSING_SCHEMA, statement, \"Schema '%s' does not exist\", schema);\n            }\n            return immediateFuture(null);\n        }\n\n        accessControl.checkCanDropSchema(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), schema);\n\n        metadata.dropSchema(session, schema);\n\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":81,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/DropSchemaTask.java#L51-L81","documentation":"Thrown by DropSchemaTask.execute when the catalog exists but metadataResolver.schemaExists(schema) is false and the statement omits IF EXISTS. The schema-level check runs after catalog and before permission checks (checkCanDropSchema).","triggerScenarios":"DROP SCHEMA catalog.schema where schemaExists returns false and statement.isExists() is false.","commonSituations":"Typo in schema name; schema already dropped by a teammate/job; confusion between database and schema terminology for connectors like Hive where database==schema; case-sensitivity with quoted identifiers.","solutions":["Run SHOW SCHEMAS FROM <catalog> and correct the schema name.","Use DROP SCHEMA IF EXISTS if the drop is conditional.","Confirm the schema wasn't already removed by another process or scheduled job."],"exampleFix":"// before\nDROP SCHEMA hive.default.tmp_etl;\n// after\nDROP SCHEMA IF EXISTS hive.default.tmp_etl;","handlingStrategy":"try-catch","validationCode":"-- pre-check schema existence\nSELECT schema_name FROM information_schema.schemata\nWHERE catalog_name = 'hive' AND schema_name = 'default';","typeGuard":null,"tryCatchPattern":"// client\ntry {\n  stmt.execute(\"DROP SCHEMA hive.old_etl\");\n} catch (SQLException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Schema\") && e.getMessage().contains(\"does not exist\")) {\n    // idempotent: already gone\n  } else { throw e; }\n}","preventionTips":["Use DROP SCHEMA IF EXISTS in teardown jobs.","Check SHOW SCHEMAS FROM <catalog> before schema-level DDL.","Coordinate with other jobs that may drop schemas concurrently."],"tags":["sql","schema","missing-object"],"backgroundTag":"schema-does-not-exist","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}