Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-8900

JDBC Sink connector: allow sink to an enum column

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Unresolved
    • Icon: Minor Minor
    • 3.4.0.Alpha1
    • None
    • jdbc-connector
    • None
    • False
    • Hide

      None

      Show
      None
    • False

       

      Bug report

      I am trying to sink from a source table that has an ENUM column to a destination table that has the same column, same enum type. I have configured my source PG connector with column.propagate.source.type and I can see the avro schema in Apicurio has:

              {
                "name": "role",
                "type": {
                  "type": "string",
                  "connect.version": 1,
                  "connect.parameters": {
                    "allowed": "system,assistant,user",
                    "__debezium.source.column.type": "ROLE",
                    "__debezium.source.column.length": "2147483647",
                    "__debezium.source.column.scale": "0",
                    "__debezium.source.column.name": "role"
                  },
                  "connect.name": "io.debezium.data.Enum"
                }
              },

      So that seems to be working. But when I try to sink with the connector, the PG query fails with 

      Caused by: org.postgresql.util.PSQLException: ERROR: column "role" is of type role but expression is of type character varying

      The relevant part of the upsert query is

      ON CONFLICT ("id","version","chat_id") DO UPDATE SET "role"=EXCLUDED."role","content"=EXCLUDED."content"

       I think it's missing a SQL cast for my enum, like adding ::role right after the value.

      What Debezium connector do you use and what version?

      3.0.8.Final

      What is the connector configuration?

      <Your answer>

      What is the captured database version and mode of deployment?

      PG 16 - docker

      What behavior do you expect?

      Sink-ing to an enum column should work

      What behavior do you see?

      <Your answer>

      Do you see the same behaviour using the latest released Debezium version?

      (Ideally, also verify with latest Alpha/Beta/CR version)

      <Your answer>

      Do you have the connector logs, ideally from start till finish?

      (You might be asked later to provide DEBUG/TRACE level log)

      <Your answer>

      How to reproduce the issue using our tutorial deployment?

      <Your answer>

      Feature request or enhancement

      For feature requests or enhancements, provide this information, please:

      Which use case/requirement will be addressed by the proposed feature?

      <Your answer>

      Implementation ideas (optional)

      <Your answer>

              Unassigned Unassigned
              jordanp38 Jordan P (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: