Issues with datatype convert in postgres: null::character varying.

17 views
Skip to first unread message

M Darling

unread,
Jan 13, 2022, 11:37:13 AMJan 13
to debezium
Hi, I use a connector of PostgreSQL to sync data to Kafka.
However, when table was created as following:

create table table_name(
     id int not null constraint "table_name_pkey" primary key,
     col1 varchar(256) default Null::character varying
);

Then we synced this table data to Kafka and met value of col1 is  "NULL::character varying"
which should be null in Kafka.

{before:null, after:{"id":1, "col1":"NULL::character varying"}, source: {...},...}

How can I address this issue without changing the table struct in Postgres?

Chris Cranford

unread,
Jan 14, 2022, 10:48:54 AMJan 14
to debe...@googlegroups.com, M Darling
Hi,

That looks like a bug in the default value handling with the PG connector.  We did make some changes recently (1.8?) around how default values were resolved.  Could you raise a Jira with your example and steps to reproduce it?

Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "debezium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to debezium+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/debezium/5ea62d37-a43c-421c-a420-623a8240c9a1n%40googlegroups.com.

Message has been deleted
Message has been deleted

M Darling

unread,
Jan 16, 2022, 9:46:10 PMJan 16
to debezium
yeah, thank you for your answer,  I had tried to reproduce the data but nothing changed with debezium 1.8.0.Final.
{
  "before": null,
  "after": {
    "id": 931237219392925696,
    "app_id": 520,
    "tenant_id": 931237219392925696,
    "name": "自动生成202201131724256",
    "flag": "1,2,12,",
    "status": 1,
    "root": true,
    "deleted": false,
    "short_name": "NULL::character varying",
    "remark": "",
    "code": "DSC",
    "create_user": "849354108934148096",
    "create_time": 1642094654731000,
    "modify_user": "849354108934148096",
    "modify_time": 1642094654662337,
    "parent_id": 0,
    "path": "/931237219392925696",
    "control_flag": 1,
    "admin_flag": 0,
    "cert_flag": 0,
    "factory_flag": 0,
    "farm_flag": 0,
    "financial_flag": 0,
    "fmc_flag": 0,
    "sale_flag": 0,
    "supervise_flag": 0,
    "ctrl_org_id": 931237219392925696,
    "costcenter_flag": null,
    "storage_flag": null,
    "purchase_flag": null,
    "device_flag": null
  },
  "source": {
    "version": "1.8.0.Final",
    "connector": "postgresql",
    "name": "xxxx",
    "ts_ms": 1642386655074,
    "snapshot": "last",
    "db": "xxxx",
    "sequence": "[null,\"24620481033888\"]",
    "schema": "xxxx",
    "table": "xxxx",
    "txId": 1692095627,
    "lsn": 24620481033888,
    "xmin": null
  },
  "op": "r",
  "ts_ms": 1642386655084,
  "transaction": null
}
Maybe this is indeed a bug!
Thanks
Reply all
Reply to author
Forward
0 new messages