{"record":{"id":"4aa241965b1d66a9","repo":"apache/seatunnel","slug":"database-connection-failed-during-resolving-unknow","errorCode":null,"errorMessage":"Database connection failed during resolving unknown type","messagePattern":"Database connection failed during resolving unknown type","errorType":"exception","errorClass":"ConnectException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/io/debezium/connector/postgresql/TypeRegistry.java","lineNumber":349,"sourceCode":"            String[] enumValues = (String[]) rs.getArray(\"enum_values\").getArray();\n            builder = builder.enumValues(Arrays.asList(enumValues));\n        } else if (CATEGORY_ARRAY.equals(category)) {\n            builder = builder.elementType((int) rs.getLong(\"element\"));\n        }\n        return builder.parentType(parentTypeOid);\n    }\n\n    private PostgresType resolveUnknownType(String name) {\n        try {\n            LOGGER.trace(\"Type '{}' not cached, attempting to lookup from database.\", name);\n\n            try (final PreparedStatement statement =\n                    connection.connection().prepareStatement(SQL_NAME_LOOKUP)) {\n                statement.setString(1, name);\n                return loadType(statement);\n            }\n        } catch (SQLException e) {\n            throw new ConnectException(\n                    \"Database connection failed during resolving unknown type\", e);\n        }\n    }\n\n    private PostgresType resolveUnknownType(int lookupOid) {\n        try {\n            LOGGER.trace(\n                    \"Type OID '{}' not cached, attempting to lookup from database.\", lookupOid);\n\n            try (final PreparedStatement statement =\n                    connection.connection().prepareStatement(SQL_OID_LOOKUP)) {\n                statement.setInt(1, lookupOid);\n                return loadType(statement);\n            }\n        } catch (SQLException e) {\n            throw new ConnectException(\n                    \"Database connection failed during resolving unknown type\", e);\n        }","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/io/debezium/connector/postgresql/TypeRegistry.java#L331-L367","documentation":"When the TypeRegistry encounters a type OID/name it does not know, it queries the database (SQL_NAME_LOOKUP) to resolve it. A SQLException during this by-name lookup is rethrown as ConnectException('Database connection failed during resolving unknown type').","triggerScenarios":"Thrown from resolveUnknownType(String) when the prepared statement or query against pg catalog fails while resolving a custom/unknown type name encountered in a decoded event or schema.","commonSituations":"Tables with custom or extension (PostGIS etc.) types forcing registry lookups; database connection lost mid-stream; permissions revoked on catalog tables.","solutions":["Restore/verify the JDBC connection to Postgres; this usually means the connection dropped.","Restrict synced tables to avoid types that require runtime lookups, or install the needed extension.","Grant catalog read permissions to the connector user.","Retry the job once connectivity is confirmed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"psql \"postgres://user@host:5432/mydb\" -c 'SELECT typname FROM pg_type LIMIT 1;'","typeGuard":null,"tryCatchPattern":"try {\n  startCdcSource(cfg);\n} catch (ConnectException e) {\n  if (e.getMessage().contains(\"resolving unknown type\")) {\n    // connection lost or missing catalog permissions; retry after check\n  }\n}","preventionTips":["Avoid capturing tables with exotic custom types, or install needed extensions.","Keep catalog read permissions in place.","Monitor connection health during streaming."],"tags":["postgres","cdc","types","database"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}