{"record":{"id":"d86f3fce3243f06b","repo":"prestodb/presto","slug":"missing-table-d86f3f","errorCode":"MISSING_TABLE","errorMessage":"Table '%s' does not exist","messagePattern":"Table '(.+?)' does not exist","errorType":"error_code","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/DropColumnTask.java","lineNumber":57,"sourceCode":"\npublic class DropColumnTask\n        implements DDLDefinitionTask<DropColumn>\n{\n    @Override\n    public String getName()\n    {\n        return \"DROP COLUMN\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(DropColumn statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getTable(), metadata);\n        Optional<TableHandle> tableHandleOptional = metadata.getMetadataResolver(session).getTableHandle(tableName);\n\n        if (!tableHandleOptional.isPresent()) {\n            if (!statement.isTableExists()) {\n                throw new SemanticException(MISSING_TABLE, statement, \"Table '%s' does not exist\", tableName);\n            }\n            return immediateFuture(null);\n        }\n\n        Optional<MaterializedViewDefinition> optionalMaterializedView = metadata.getMetadataResolver(session).getMaterializedView(tableName);\n        if (optionalMaterializedView.isPresent()) {\n            if (!statement.isTableExists()) {\n                throw new SemanticException(NOT_SUPPORTED, statement, \"'%s' is a materialized view, and drop column is not supported\", tableName);\n            }\n            return immediateFuture(null);\n        }\n\n        TableHandle tableHandle = tableHandleOptional.get();\n        Identifier columnIdentifier = statement.getColumn();\n        String column = metadata.normalizeIdentifier(session, tableName.getCatalogName(), columnIdentifier.getValue());\n\n        accessControl.checkCanDropColumn(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName);\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/DropColumnTask.java#L39-L75","documentation":"DropColumnTask.execute resolves the table handle for ALTER TABLE ... DROP COLUMN. If getTableHandle returns empty the table does not exist; unless IF EXISTS was given, it throws SemanticException(MISSING_TABLE). With IF EXISTS it silently returns.","triggerScenarios":"Executing ALTER TABLE <name> DROP COLUMN <col> (without IF EXISTS) where the connector cannot resolve the table name to a TableHandle.","commonSituations":"Typo or wrong case in table name; table already dropped in a concurrent session; referencing a view/materialized-view name expecting table behavior; wrong catalog/schema qualification in multi-tenant scripts.","solutions":["Verify the table exists via SHOW TABLES / SHOW CREATE and fix the name.","Use IF EXISTS (ALTER TABLE ... DROP COLUMN ... requires the table-level IF EXISTS supported by this syntax) to make the operation idempotent.","Check that you are connected to the intended catalog/schema."],"exampleFix":"// before\nALTER TABLE hive.default.events DROP COLUMN temp_flag; -- table gone\n// after\nDROP TABLE IF EXISTS ...; -- or re-create\nALTER TABLE hive.default.events_backup DROP COLUMN temp_flag;","handlingStrategy":"validation","validationCode":"-- Confirm table exists before DROP COLUMN\nSELECT table_name FROM information_schema.tables\nWHERE table_catalog = 'hive' AND table_schema = 'default' AND table_name = 'events';","typeGuard":null,"tryCatchPattern":"try {\n  session.execute(alterDropColumnSql);\n} catch (e) {\n  if (/Table '.*' does not exist/.test(e.message)) {\n    log.warn(`Table missing, skipping: ${e.message}`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Use IF EXISTS in migration scripts that may run against partially migrated environments.","Check SHOW CREATE TABLE to confirm the target is a real table, not a view or materialized view.","Fully qualify table names in all DDL scripts."],"tags":["presto","sql","missing-table","ddl"],"backgroundTag":"table-not-found","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"}