{"record":{"id":"4acb965c0937b81e","repo":"apache/iceberg","slug":"database-properties-should-not-contain-key-comme","errorCode":null,"errorMessage":"Database properties should not contain key: 'comment'.","messagePattern":"Database properties should not contain key: 'comment'\\.","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java","lineNumber":240,"sourceCode":"      throws DatabaseAlreadyExistException, CatalogException {\n    if (asNamespaceCatalog != null) {\n      try {\n        asNamespaceCatalog.createNamespace(appendLevel(baseNamespace, databaseName), metadata);\n      } catch (AlreadyExistsException e) {\n        if (!ignoreIfExists) {\n          throw new DatabaseAlreadyExistException(getName(), databaseName, e);\n        }\n      }\n    } else {\n      throw new UnsupportedOperationException(\n          \"Namespaces are not supported by catalog: \" + getName());\n    }\n  }\n\n  private Map<String, String> mergeComment(Map<String, String> metadata, String comment) {\n    Map<String, String> ret = Maps.newHashMap(metadata);\n    if (metadata.containsKey(\"comment\")) {\n      throw new CatalogException(\"Database properties should not contain key: 'comment'.\");\n    }\n\n    if (!StringUtils.isNullOrWhitespaceOnly(comment)) {\n      ret.put(\"comment\", comment);\n    }\n    return ret;\n  }\n\n  @Override\n  public void dropDatabase(String name, boolean ignoreIfNotExists, boolean cascade)\n      throws DatabaseNotExistException, DatabaseNotEmptyException, CatalogException {\n    if (asNamespaceCatalog != null) {\n      try {\n        boolean success = asNamespaceCatalog.dropNamespace(appendLevel(baseNamespace, name));\n        if (!success && !ignoreIfNotExists) {\n          throw new DatabaseNotExistException(getName(), name);\n        }\n      } catch (NoSuchNamespaceException e) {","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L222-L258","documentation":"FlinkCatalog.mergeComment validates that the database properties map does not already contain the reserved key 'comment', since Flink passes the database comment separately. A 'comment' entry inside metadata would collide with the comment argument, so creation aborts with CatalogException.","triggerScenarios":"createDatabase (or newProperties) is called with database metadata containing key 'comment' — e.g. Flink SQL CREATE DATABASE ... WITH ('comment'='x') plus a COMMENT clause, or programmatic creation passing a properties map containing 'comment'.","commonSituations":"Specifying the comment both as a Flink option and as a database property; ORM/tooling that serializes comments into the properties map; migrating DDL from another engine that put comments in properties.","solutions":["Remove the 'comment' key from the WITH/properties clause and pass it only via COMMENT 'x' (or vice versa).","Strip 'comment' from the properties map before calling createDatabase programmatically.","Use a different property key (e.g. 'comment' is reserved; choose 'notes' or a custom key)."],"exampleFix":"// before\nCREATE DATABASE db WITH ('comment' = 'x');\n// after\nCREATE DATABASE db COMMENT 'x';","handlingStrategy":"validation","validationCode":"Map<String, String> safe = new HashMap<>(props);\nsafe.remove(\"comment\");\nflinkCatalog.createDatabase(name, safe, ignoreIfExists);","typeGuard":null,"tryCatchPattern":"try {\n  flinkCatalog.createDatabase(name, props, false);\n} catch (CatalogException e) {\n  // strip 'comment' key and retry, or surface a clear DDL fix\n}","preventionTips":["Never put 'comment' in database WITH options; use COMMENT clause only.","Filter reserved keys when copying property maps.","Validate DDL generation templates for duplicate comment sources."],"tags":["flink","catalog","reserved-key"],"backgroundTag":"conflicting-config-options","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"}