{"record":{"id":"da4ae9ea4560d504","repo":"prestodb/presto","slug":"missing-table-da4ae9","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/RenameTableTask.java","lineNumber":56,"sourceCode":"import static com.google.common.util.concurrent.Futures.immediateFuture;\n\npublic class RenameTableTask\n        implements DDLDefinitionTask<RenameTable>\n{\n    @Override\n    public String getName()\n    {\n        return \"RENAME TABLE\";\n    }\n\n    @Override\n    public ListenableFuture<?> execute(RenameTable statement, TransactionManager transactionManager, Metadata metadata, AccessControl accessControl, Session session, List<Expression> parameters, WarningCollector warningCollector, String query)\n    {\n        QualifiedObjectName tableName = createQualifiedObjectName(session, statement, statement.getSource(), metadata);\n        Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);\n        if (!tableHandle.isPresent()) {\n            if (!statement.isExists()) {\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.isExists()) {\n                throw new SemanticException(NOT_SUPPORTED, statement, \"'%s' is a materialized view, and rename is not supported\", tableName);\n            }\n            return immediateFuture(null);\n        }\n\n        QualifiedObjectName target = createQualifiedObjectName(session, statement, statement.getTarget(), metadata);\n        getConnectorIdOrThrow(session, metadata, target.getCatalogName(), statement, targetTableCatalogError);\n        if (metadata.getMetadataResolver(session).getTableHandle(target).isPresent()) {\n            throw new SemanticException(TABLE_ALREADY_EXISTS, statement, \"Target table '%s' already exists\", target);\n        }\n        if (!tableName.getCatalogName().equals(target.getCatalogName())) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/RenameTableTask.java#L38-L74","documentation":"SemanticException (MISSING_TABLE) raised while resolving the source name of an ALTER TABLE ... RENAME statement: the metadata resolver found no table handle for the fully qualified source name. Note that with IF EXISTS the statement silently succeeds instead.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/RenameTableTask.java:56 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify spelling and qualification (catalog.schema.table) of the source table with SHOW TABLES","Append IF EXISTS to the RENAME statement if the no-op behavior is acceptable","Create the table first if it was expected to exist"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}