{"record":{"id":"7c78fd38e303c5de","repo":"prestodb/presto","slug":"table-not-found-new-schematablename-database-t","errorCode":null,"errorMessage":"Table not found: ${new SchemaTableName(database, tableName)}","messagePattern":"Table not found: (.+?)","errorType":"exception","errorClass":"TableNotFoundException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/HiveTableOperations.java","lineNumber":220,"sourceCode":"        return currentMetadata;\n    }\n\n    @Override\n    public TableMetadata refresh()\n    {\n        if (location.isPresent()) {\n            refreshFromMetadataLocation(null);\n            return currentMetadata;\n        }\n\n        Table table = getTable();\n\n        if (!isIcebergTable(table)) {\n            throw new UnknownTableTypeException(\"Not an Iceberg table: \" + getSchemaTableName());\n        }\n\n        if (isPrestoView(table)) {\n            throw new TableNotFoundException(new SchemaTableName(database, tableName));\n        }\n\n        String metadataLocation = table.getParameters().get(METADATA_LOCATION);\n        if (metadataLocation == null) {\n            throw new PrestoException(ICEBERG_INVALID_METADATA, format(\"Table is missing [%s] property: %s\", METADATA_LOCATION, getSchemaTableName()));\n        }\n\n        refreshFromMetadataLocation(metadataLocation);\n\n        return currentMetadata;\n    }\n\n    @Override\n    public void commit(@Nullable TableMetadata base, TableMetadata metadata)\n    {\n        requireNonNull(metadata, \"metadata is null\");\n\n        // if the metadata is already out of date, reject it","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/HiveTableOperations.java#L202-L238","documentation":"During refresh, after confirming the table is an Iceberg table, Presto checks whether the Hive table is actually a Presto view; if so it throws TableNotFoundException with 'Table not found: <schema.table>'. This makes Iceberg operations on Presto-defined views behave as if the table does not exist.","triggerScenarios":"Calling refresh (via current()/metadata()) on a schema.table that resolves in the metastore to a Presto view (isPrestoView true) — e.g. a view name passed where a table is expected, or name shadowing between a view and intended Iceberg table.","commonSituations":"Views created via the Hive connector being accessed through the Iceberg connector, reusing a dropped table's name for a view, typos that resolve to an existing view instead of the intended table.","solutions":["Use the catalog where the view is defined (usually hive) to query the view.","Rename the view or the table to avoid shadowing in the Iceberg catalog namespace.","Verify with SHOW CREATE TABLE / metastore inspection which object the name refers to.","Create the Iceberg table if it is genuinely missing and only the view exists."],"exampleFix":"-- before: SELECT * FROM iceberg.default.my_view; -- Table not found\n-- after\nSELECT * FROM hive.default.my_view;","handlingStrategy":"validation","validationCode":"Table t = metastore.getTable(db, name);\nif (t == null || isPrestoView(t)) {\n  throw new TableNotFoundException(new SchemaTableName(db, name));\n}","typeGuard":"boolean isRealTable(Table t) { return t != null && t.getTableType() != null && t.getTableType().equals(TableType.EXTERNAL_TABLE.toString()) && !isPrestoView(t); }","tryCatchPattern":"try { icebergOps.refresh(); } catch (TableNotFoundException e) { /* route query to hive catalog or fail with clear message */ }","preventionTips":["Do not reuse a dropped table's name for a view in the same schema","Resolve views through the connector that created them","List objects (SHOW TABLES FROM catalog) before referencing names","Keep naming conventions that distinguish views from tables"],"tags":["iceberg","view","table-not-found","catalog"],"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"}