{"record":{"id":"9d485989e337eb24","repo":"apache/iceberg","slug":"jdbc-catalog-is-initialized-without-view-support","errorCode":null,"errorMessage":"JDBC catalog is initialized without view support. To auto-migrate the database's schema and enable view support, set jdbc.schema-version=V1","messagePattern":"JDBC catalog is initialized without view support\\. To auto-migrate the database's schema and enable view support, set jdbc\\.schema-version=V1","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java","lineNumber":289,"sourceCode":"    }\n  }\n\n  private static boolean executeV1CatalogUpdate(Connection conn) throws SQLException {\n    try (PreparedStatement stmt = conn.prepareStatement(JdbcUtil.V1_UPDATE_CATALOG_SQL)) {\n      return stmt.execute();\n    }\n  }\n\n  @Override\n  protected TableOperations newTableOps(TableIdentifier tableIdentifier) {\n    return new JdbcTableOperations(\n        connections, io, catalogName, tableIdentifier, catalogProperties, schemaVersion);\n  }\n\n  @Override\n  protected ViewOperations newViewOps(TableIdentifier viewIdentifier) {\n    if (schemaVersion != JdbcUtil.SchemaVersion.V1) {\n      throw new UnsupportedOperationException(VIEW_WARNING_LOG_MESSAGE);\n    }\n    return new JdbcViewOperations(connections, io, catalogName, viewIdentifier, catalogProperties);\n  }\n\n  @Override\n  protected String defaultWarehouseLocation(TableIdentifier table) {\n    String tableLocation = LocationUtil.tableLocation(table, uniqueTableLocation);\n    return SLASH.join(defaultNamespaceLocation(table.namespace()), tableLocation);\n  }\n\n  @Override\n  public boolean dropTable(TableIdentifier identifier, boolean purge) {\n    TableOperations ops = newTableOps(identifier);\n    TableMetadata lastMetadata = null;\n    if (purge) {\n      try {\n        lastMetadata = ops.current();\n      } catch (NotFoundException e) {","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java#L271-L307","documentation":"Thrown by JdbcCatalog.newViewOps when view operations are requested but the catalog's jdbc.schema-version is not V1, meaning the underlying database tables were not migrated to the view-capable schema. This UnsupportedOperationException exists because views require extra catalog tables/columns that a V0 database lacks.","triggerScenarios":"Any view API call (catalog.loadView, createView, registerView, etc.) on a JdbcCatalog configured with jdbc.schema-version=V0 (or on a legacy V0 database that was not migrated).","commonSituations":"Upgrading Iceberg and starting to use views while the JDBC catalog database is still on the old V0 schema, or explicitly pinning jdbc.schema-version=V0 for compatibility with older deployments.","solutions":["Set jdbc.schema-version=V1 in the catalog properties to enable auto-migration and view support","Restart catalog initialization so updateSchemaIfRequired migrates the database to V1","If you must stay on V0, use tables only and avoid view APIs","Back up the catalog database before the V0→V1 migration"],"exampleFix":"// before\nprops.put(\"jdbc.schema-version\", \"V0\");\n// after\nprops.put(\"jdbc.schema-version\", \"V1\"); // enables views; auto-migrates on initialize()","handlingStrategy":"validation","validationCode":"JdbcCatalog jdbc = (JdbcCatalog) catalog;\n// or check properties before creating views:\nString v = catalogProps.getOrDefault(\"jdbc.schema-version\", \"\");\nif (!\"V1\".equals(v)) {\n  throw new IllegalStateException(\"View support requires jdbc.schema-version=V1\");\n}","typeGuard":"boolean viewSupported(Map<String,String> catalogProps) {\n  return \"V1\".equals(catalogProps.getOrDefault(\"jdbc.schema-version\", \"V0\"));\n}","tryCatchPattern":"try {\n  catalog.loadView(ident);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"view support\")) {\n    // reconfigure with jdbc.schema-version=V1 and re-init\n  } else { throw e; }\n}","preventionTips":["Always set jdbc.schema-version=V1 if you plan to use views","Back up the catalog database before the V0→V1 migration","Gate view code paths on schema version at application startup","Do not pin V0 on deployments that need views"],"tags":["jdbc","views","unsupported-operation","schema-version"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}