{"record":{"id":"9579233889900b28","repo":"prestodb/presto","slug":"missing-table-957923","errorCode":"MISSING_TABLE","errorMessage":"View '%s' does not exist","messagePattern":"View '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/DropViewTask.java","lineNumber":52,"sourceCode":"\npublic class DropViewTask\n        implements DDLDefinitionTask<DropView>\n{\n    @Override\n    public String getName()\n    {\n        return \"DROP VIEW\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(DropView statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        QualifiedObjectName name = createQualifiedObjectName(session, statement, statement.getName(), metadata);\n\n        Optional<ViewDefinition> view = metadata.getMetadataResolver(session).getView(name);\n        if (!view.isPresent()) {\n            if (!statement.isExists()) {\n                throw new SemanticException(MISSING_TABLE, statement, \"View '%s' does not exist\", name);\n            }\n            return immediateFuture(null);\n        }\n\n        accessControl.checkCanDropView(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), name);\n\n        metadata.dropView(session, name);\n\n        return immediateFuture(null);\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":64,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/DropViewTask.java#L34-L64","documentation":"Thrown by DropViewTask when DROP VIEW references a name for which metadata.getMetadataResolver(session).getView(name) returns empty. The error code is MISSING_TABLE because Presto reuses the missing-relation code for views; if IF EXISTS was given, the task succeeds silently instead.","triggerScenarios":"Executing `DROP VIEW view_name` where no ViewDefinition exists for that QualifiedObjectName and statement.isExists() is false.","commonSituations":"Dropping a view that was already dropped; confusing a table with a view (DROP VIEW on a table name); wrong schema in the session; case-sensitivity mismatch in quoted identifiers.","solutions":["Confirm the object is a view with SHOW CREATE / information_schema.views","Fix the name or qualify it with the correct catalog.schema","Use DROP VIEW IF EXISTS for idempotent cleanup scripts"],"exampleFix":"// before\nDROP VIEW daily_agg;\n// after\nDROP VIEW IF EXISTS reporting.daily_agg;","handlingStrategy":"validation","validationCode":"-- confirm the name is a view, not a table\nSELECT table_type FROM information_schema.tables\nWHERE table_schema = 'my_schema' AND table_name = 'daily_agg';","typeGuard":null,"tryCatchPattern":"try { dropView(...); } catch (SemanticException e) { if (e.getCode() == SemanticErrorCode.MISSING_TABLE) { /* already gone; log and continue */ } else { throw e; } }","preventionTips":["Prefer DROP VIEW IF EXISTS in cleanup scripts","Distinguish tables from views via information_schema before dropping","Keep session schema (USE) consistent with the objects being dropped"],"tags":["presto","sql","missing-view","semantic-error"],"backgroundTag":"object-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"}