{"record":{"id":"fb984c33f741cdd3","repo":"prestodb/presto","slug":"view-not-found-fb984c","errorCode":null,"errorMessage":"View not found","messagePattern":"View not found","errorType":"exception","errorClass":"ViewNotFoundException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java","lineNumber":2504,"sourceCode":"        catch (TableAlreadyExistsException e) {\n            throw new ViewAlreadyExistsException(e.getTableName());\n        }\n    }\n\n    @Override\n    public void dropView(ConnectorSession session, SchemaTableName viewName)\n    {\n        ConnectorViewDefinition view = getViews(session, viewName.toSchemaTablePrefix()).get(viewName);\n        checkIfNullView(view, viewName);\n\n        try {\n            metastore.dropTable(\n                    new HdfsContext(session, viewName.getSchemaName()),\n                    viewName.getSchemaName(),\n                    viewName.getTableName());\n        }\n        catch (TableNotFoundException e) {\n            throw new ViewNotFoundException(e.getTableName());\n        }\n    }\n\n    @Override\n    public List<SchemaTableName> listViews(ConnectorSession session, String schemaNameOrNull)\n    {\n        ImmutableList.Builder<SchemaTableName> tableNames = ImmutableList.builder();\n        MetastoreContext metastoreContext = getMetastoreContext(session);\n        for (String schemaName : listSchemas(session, schemaNameOrNull)) {\n            for (String tableName : metastore.getAllViews(metastoreContext, schemaName).orElse(emptyList())) {\n                tableNames.add(new SchemaTableName(schemaName, tableName));\n            }\n        }\n        return tableNames.build();\n    }\n\n    @Override\n    public Map<SchemaTableName, ConnectorViewDefinition> getViews(ConnectorSession session, SchemaTablePrefix prefix)","sourceCodeStart":2486,"sourceCodeEnd":2522,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java#L2486-L2522","documentation":"Mapped from TableNotFoundException when DROP VIEW cannot find the named object: the connector delegates to metastore.dropTable and translates the missing-table error into ViewNotFoundException. It means no Presto view with that schema.table name exists in the metastore.","triggerScenarios":"DROP VIEW on a name that was never created, was already dropped, exists only as a plain Hive table (not a view), or whose schema is misspelled/points at the wrong catalog.","commonSituations":"Non-idempotent cleanup scripts dropping views twice; typo in schema or view name; querying the wrong catalog (e.g. hive vs iceberg) where the view does not exist; views dropped by another team member.","solutions":["Use DROP VIEW IF EXISTS to make the statement idempotent","Verify the exact name with SHOW TABLES / system metadata or listViews","Confirm you are connected to the right catalog and schema","If a plain table with that name exists, use DROP TABLE instead of DROP VIEW"],"exampleFix":"-- before\nDROP VIEW analytics.daily_revenue;\n-- after\nDROP VIEW IF EXISTS analytics.daily_revenue;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    run(\"DROP VIEW \" + name);\n} catch (ViewNotFoundException e) {\n    // already gone — fine for cleanup scripts\n    log.info(\"View absent, skipping: {}\", name);\n}","preventionTips":["Always use DROP VIEW IF EXISTS in scripts","Confirm object type (view vs table) before dropping","Pin the catalog/schema in automated jobs","Check listViews output before destructive cleanup"],"tags":["hive","view","not-found","ddl"],"backgroundTag":"object-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"}