Skip to content

table name in JSON DDL payload mismatch #244

@caryhuang

Description

@caryhuang

description

when a table is created with foreign key reference in Oracle, OpenlogReplicator produces a DDL JSON message that has table name mismatch between "payload"."schema"."table" and the table name in "payload"."sql". My expectation is that both should match like a normal CREATE TABLE ddl JSON.

OpenlogReplicator version

1.8.5

Oracle version

19c (https://hub.docker.com/r/doctorkirk/oracle-19c)

OpenlogReplicator configuration

{
  "version": "1.8.5",
  "source": [
    {
      "alias": "SOURCE",
      "name": "ORACLE",
      "reader": {
        "type": "online",
        "user": "DBZUSER",
        "password": "dbz",
        "server": "//ora19c:1521/FREE"
      },
      "format": {
        "type": "json",
        "column": 2,
        "db": 3,
        "interval-dts": 9,
        "interval-ytm": 4,
        "message": 2,
        "rid": 1,
        "schema": 7,
        "timestamp-all": 1,
        "scn-type": 1
      },
      "memory": {
        "min-mb": 256,
        "max-mb": 512,
        "swap-path": "/opt/OpenLogReplicator/olrswap"
      },
      "filter": {
        "table": [
          {"owner": "DBZUSER", "table": ".*"}
        ]
      },
      "flags": 32
    }
  ],
  "target": [
    {
      "alias": "DEBEZIUM",
      "source": "SOURCE",
      "writer": {
        "type": "network",
        "uri": "0.0.0.0:7070"
      }
    }
  ]
}

Oracle Query

CREATE TABLE t_constraints (
  id NUMBER CONSTRAINT pk_tc PRIMARY KEY,
  email VARCHAR2(320) UNIQUE,
  dept_id NUMBER,
  status CHAR(1) CHECK (status IN ('A','I')),
  CONSTRAINT fk_tc_dept FOREIGN KEY (dept_id) REFERENCES dept(id)
    ON DELETE SET NULL
    DEFERRABLE INITIALLY DEFERRED
    ENABLE NOVALIDATE
);

where dept has already been created long ago with:

CREATE TABLE dept (
  id   NUMBER PRIMARY KEY,
  name VARCHAR2(100));

DDL JSON produced by Openlog Replicator

{
  "scn": 2296399,
  "tm": 1758062628000000000,
  "c_scn": 2296402,
  "c_idx": 4,
  "xid": "0x0001.014.000003bc",
  "db": "FREE",
  "payload": [
    {
      "op": "ddl",
      "schema": {
        "owner": "DBZUSER",
        "table": "DEPT",
        "obj": 73412,
        "columns": [
          {
            "name": "ID",
            "type": "number",
            "precision": -1,
            "scale": -1,
            "nullable": false
          },
          {
            "name": "NAME",
            "type": "varchar2",
            "length": 0,
            "nullable": true
          }
        ]
      },
      "sql": "CREATE TABLE t_constraints (\n  id NUMBER CONSTRAINT pk_tc PRIMARY KEY,\n  email VARCHAR2(320) UNIQUE,\n  dept_id NUMBER,\n  status CHAR(1) CHECK (status IN ('A','I')),\n  CONSTRAINT fk_tc_dept FOREIGN KEY (dept_id) REFERENCES dept(id)\n    ON DELETE SET NULL\n    DEFERRABLE INITIALLY DEFERRED\n    ENABLE NOVALIDATE\n)"
    }
  ]
}

as you can see:

  • "payload"."schema"."table" displays as "DEPT", which is the foreign table the query's foreign key references
  • "payload"."sql" tries to create table t_constraints

I think "payload"."schema"."table" should also be t_constraints to be consistent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions