{"record":{"id":"ef329978a9c27061","repo":"apache/iceberg","slug":"view-does-not-exist-s-ef3299","errorCode":null,"errorMessage":"View does not exist: %s","messagePattern":"View does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java","lineNumber":749,"sourceCode":"    int updatedRecords =\n        execute(\n            err -> {\n              if (JdbcUtil.isConstraintViolation(err)) {\n                throw new AlreadyExistsException(\n                    \"Cannot rename %s to %s. View already exists\", from, to);\n              }\n            },\n            JdbcUtil.RENAME_VIEW_SQL,\n            JdbcUtil.namespaceToString(to.namespace()),\n            to.name(),\n            catalogName,\n            JdbcUtil.namespaceToString(from.namespace()),\n            from.name());\n\n    if (updatedRecords == 1) {\n      LOG.info(\"Renamed view from {}, to {}\", from, to);\n    } else if (updatedRecords == 0) {\n      throw new NoSuchViewException(\"View does not exist: %s\", from);\n    } else {\n      LOG.warn(\n          \"Rename operation affected {} rows: the catalog view's primary key assumption has been violated\",\n          updatedRecords);\n    }\n  }\n\n  @VisibleForTesting\n  JdbcClientPool connectionPool() {\n    return connections;\n  }\n\n  private int execute(String sql, String... args) {\n    return execute(err -> {}, sql, args);\n  }\n\n  private int execute(Consumer<SQLException> sqlErrorHandler, String sql, String... args) {\n    try {","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java#L731-L767","documentation":"JdbcCatalog.renameView issues an UPDATE for the source view; if zero rows are affected the source view did not exist, so the catalog throws NoSuchViewException. This is the catalog's way of reporting that the rename's `from` identifier is absent from the view table.","triggerScenarios":"Calling catalog.renameView(from, to) when `from` was never created as a view, was already deleted, or exists as a table but not a view; also when the caller targets the wrong catalog/database.","commonSituations":"Typos in the view name or namespace; view deleted by another process between existence check and rename; pointing the catalog at the wrong JDBC database or table prefix.","solutions":["Verify the view exists with catalog.viewExists(from) before renaming","Check the view name and namespace for typos and case","Confirm you are connected to the correct JDBC catalog database","Handle NoSuchViewException if the view may legitimately be missing"],"exampleFix":"// before\ncatalog.renameView(from, to);\n// after\nif (catalog.viewExists(from)) {\n  catalog.renameView(from, to);\n}","handlingStrategy":"validation","validationCode":"if (!catalog.viewExists(from)) {\n  throw new IllegalStateException(\"Source view missing: \" + from);\n}\ncatalog.renameView(from, to);","typeGuard":null,"tryCatchPattern":"try {\n  catalog.renameView(from, to);\n} catch (NoSuchViewException e) {\n  LOG.warn(\"View missing, skipping rename: {}\", from);\n}","preventionTips":["Verify the source view exists before renaming","Guard against concurrent deletions (existence check is not atomic; be ready to catch)","Confirm the catalog configuration (JDBC URL/database) matches the environment"],"tags":["jdbc","catalog","view","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}