Details
-
Bug
-
Resolution: Not a Bug
-
Critical
-
None
-
1.8.0.Final
-
None
-
False
-
False
-
1.8.0-Final
-
Description
We are onboarding Debezium 1.8.0 Final postgresql connector. One of our database(s) uses a lot of ENUM Types. For e.g.
CREATE TYPE status AS ENUM ( 'REJECTED', 'ACCEPTED', 'CREATED', 'READY');
We are getting following error when creating the connector
java.lang.Object; cannot be cast to [Ljava.lang.String;","class<span class="code-quote">":"java.lang.ClassCastException","stacktrace":"java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String; io.debezium.connector.postgresql.TypeRegistry.createTypeBuilderFromResultSet(TypeRegistry.java:357) io.debezium.connector.postgresql.TypeRegistry.prime(TypeRegistry.java:320) io.debezium.connector.postgresql.TypeRegistry.<init>(TypeRegistry.java:126)
A little digging into the code here
if (CATEGORY_ENUM.equals(category)) { String[] enumValues = (String[]) rs.getArray("enum_values").getArray(); builder = builder.enumValues(Arrays.asList(enumValues)); }
ResultSet.getArray("enum_values") - RETURNS: an Array object representing the SQL ARRAY value in the specified column
and
Array.getArray() - Returns an Object.
I am not a Java expert so please pardon if my understanding here is wrong but it looks like it is trying to cast an Object[] to String array which based on the exception will always fail. I ran the SQL_TEXT query from the code in my database and I can confirm that it returns what the code is expecting -
NOTE: I went through prior issues that were raised regarding PostgresSQL ENUM and tried the configs which didn't work in my case.
"column.propagate.source.type": ".*" "include.unknown.datatypes": "true"