{"record":{"id":"238a64116677d34b","repo":"prestodb/presto","slug":"not-found-238a64","errorCode":"NOT_FOUND","errorMessage":"Table does not exist: %s","messagePattern":"Table does not exist: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/SetPropertiesTask.java","lineNumber":102,"sourceCode":"        }\n\n        return immediateFuture(null);\n    }\n\n    private void setTableProperties(SetProperties statement, QualifiedObjectName tableName, Metadata metadata, AccessControl accessControl, Session session, Map<String, Object> properties)\n    {\n        if (metadata.getMetadataResolver(session).getMaterializedView(tableName).isPresent()) {\n            throw new PrestoException(NOT_SUPPORTED, \"Cannot set table properties to a materialized view\");\n        }\n\n        if (metadata.getMetadataResolver(session).getView(tableName).isPresent()) {\n            throw new PrestoException(NOT_SUPPORTED, \"Cannot set table properties to a view\");\n        }\n\n        Optional<TableHandle> tableHandle = metadata.getMetadataResolver(session).getTableHandle(tableName);\n        if (!tableHandle.isPresent()) {\n            if (!statement.isTableExists()) {\n                throw new PrestoException(NOT_FOUND, format(\"Table does not exist: %s\", tableName));\n            }\n            return;\n        }\n\n        accessControl.checkCanSetTableProperties(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), tableName, properties);\n        metadata.setTableProperties(session, tableHandle.get(), properties);\n    }\n\n    private void setMaterializedViewProperties(SetProperties statement, QualifiedObjectName viewName, Metadata metadata, AccessControl accessControl, Session session, Map<String, Object> properties)\n    {\n        if (!metadata.getMetadataResolver(session).getMaterializedView(viewName).isPresent()) {\n            if (!statement.isTableExists()) {\n                throw new PrestoException(NOT_FOUND, format(\"Materialized view does not exist: %s\", viewName));\n            }\n            return;\n        }\n\n        accessControl.checkCanSetTableProperties(session.getRequiredTransactionId(), session.getIdentity(), session.getAccessControlContext(), viewName, properties);","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/SetPropertiesTask.java#L84-L120","documentation":"When the target of ALTER ... SET PROPERTIES has no table handle (the name does not resolve to any table), the handler throws PrestoException(NOT_FOUND) unless the statement was issued with IF EXISTS, in which case it silently returns. The message identifies the fully qualified name that could not be found. This is the existence check after view/materialized-view checks pass.","triggerScenarios":"ALTER TABLE <name> SET PROPERTIES ... where <name> does not exist and IF EXISTS was not specified.","commonSituations":"Typos in table names; wrong catalog or schema in the session; table dropped concurrently or never created; environment drift between dev and prod.","solutions":["Create the table or correct the name, then re-run the ALTER.","Add IF EXISTS to make missing tables a no-op: ALTER TABLE IF EXISTS ... SET PROPERTIES ...","Qualify the name with the correct catalog.schema and verify with SHOW TABLES."],"exampleFix":"-- before\nALTER TABLE old_schema.orders SET PROPERTIES ...\n-- after\nALTER TABLE IF EXISTS analytics.orders SET PROPERTIES ...","handlingStrategy":"validation","validationCode":"SELECT 1 FROM information_schema.tables\nWHERE table_catalog='<cat>' AND table_schema='<sch>' AND table_name='<name>';\n-- only run ALTER ... SET PROPERTIES if a row is returned","typeGuard":null,"tryCatchPattern":"try {\n  await run(\"ALTER TABLE t SET PROPERTIES ...\");\n} catch (e) {\n  if (e.message.includes(\"Table does not exist\")) {\n    console.error(`Target missing; check catalog/schema or use IF EXISTS: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Fully qualify catalog.schema.table in all DDL.","Use IF EXISTS when dropping/recreating flows may race with property changes.","Verify names with SHOW TABLES before scripting ALTERs.","Sync environment inventories (dev vs prod) before migrations."],"tags":["sql","ddl","presto","not-found","missing-object"],"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-12T02:17:10.037Z"}