{"record":{"id":"68ed645e8259cfa5","repo":"apache/seatunnel","slug":"the-catalog-is-not-supported-the-getlistdataba","errorCode":null,"errorMessage":"The catalog: {} is not supported the getListDatabaseSql for databaseExists","messagePattern":"The catalog: (.+?) is not supported the getListDatabaseSql for databaseExists","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/kingbase/KingbaseCatalog.java","lineNumber":151,"sourceCode":"\n    @Override\n    protected String getListDatabaseSql() {\n        return \"SELECT current_database();\";\n    }\n\n    /**\n     * Override the databaseExists method because SELECT current_database() does not support WHERE\n     */\n    @Override\n    public boolean databaseExists(String databaseName) throws CatalogException {\n        if (StringUtils.isBlank(databaseName)) {\n            return false;\n        }\n        try {\n            return querySQLResultExists(getUrlFromDatabaseName(databaseName), getListDatabaseSql());\n        } catch (SeaTunnelRuntimeException e) {\n            if (e.getSeaTunnelErrorCode().getCode().equals(UNSUPPORTED_METHOD.getCode())) {\n                log.warn(\n                        \"The catalog: {} is not supported the getListDatabaseSql for databaseExists\",\n                        this.catalogName);\n                return listDatabases().contains(databaseName);\n            }\n            throw e;\n        } catch (SQLException e) {\n            throw new CatalogException(\"查询数据库是否存在失败: \" + databaseName, e);\n        }\n    }\n\n    @Override\n    protected String getCreateTableSql(\n            TablePath tablePath, CatalogTable table, boolean createIndex) {\n        return new KingbaseCreateTableSqlBuilder(table, createIndex).build(tablePath);\n    }\n\n    @Override\n    protected String getDropTableSql(TablePath tablePath) {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/catalog/kingbase/KingbaseCatalog.java#L133-L169","documentation":"KingbaseCatalog.databaseExists() probes database existence with a driver-specific getListDatabaseSql() query. If that method throws SeaTunnelRuntimeException with UNSUPPORTED_METHOD (not implemented or unsupported by the dialect), the catalog logs this warning and falls back to listing all databases via metadata and checking membership. Execution continues with the fallback result.","triggerScenarios":"Calling databaseExists(databaseName) on a KingbaseCatalog whose getListDatabaseSql() is unimplemented/unsupported, so querySQLResultExists throws UNSUPPORTED_METHOD.","commonSituations":"Running Kingbase catalog operations (e.g., auto table creation flows that check whether the target database exists) against Kingbase versions/drivers where the database-list query is not supported.","solutions":["Rely on the built-in fallback; verify listDatabases() returns the database with matching case.","Implement getListDatabaseSql() for Kingbase (e.g., SELECT datname FROM sys_database) in the catalog.","Upgrade the SeaTunnel connector version where Kingbase support is more complete.","Check identifier case: the fallback is case-sensitive contains(), so pass the exact database name."],"exampleFix":"// before (base default)\nprotected String getListDatabaseSql() {\n    throw new SeaTunnelRuntimeException(UNSUPPORTED_METHOD, ...);\n}\n// after (Kingbase override)\n@Override\nprotected String getListDatabaseSql() {\n    return \"SELECT DATNAME FROM SYS_DATABASE\";\n}","handlingStrategy":"fallback","validationCode":"// Guard case-sensitivity before calling\nString name = databaseName;\nif (!catalog.listDatabases().stream().anyMatch(d -> d.equalsIgnoreCase(name))) {\n    throw new IllegalStateException(\"Database does not exist: \" + name);\n}","typeGuard":null,"tryCatchPattern":"// databaseExists handles UNSUPPORTED_METHOD internally; no extra catch needed\nboolean exists = catalog.databaseExists(databaseName);\n","preventionTips":["Pass exact-case database names; the fallback contains() is case-sensitive","Use a Kingbase driver/connector version with complete dialect support","Treat the WARN as informational, not an error"],"tags":["jdbc","catalog","kingbase","unsupported-operation","fallback"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}