eulerto / wal2json

JSON output plugin for changeset extraction
BSD 3-Clause "New" or "Revised" License
1.33k stars 161 forks source link

Change data not captured properly while operating with partition tables #259

Open MohamedKamarudeen opened 1 year ago

MohamedKamarudeen commented 1 year ago

Created table and partition table in Postgres DB using the following DDLs:

--root table / partitioned table
create table public.test_partition (id int , name varchar(20)) partition by range(id);

--partitions
create table public.test_partition_P00 partition of public.test_partition for values from (1) to (100);
create table public.test_partition_P01 partition of public.test_partition for values from (101) to (200);

With the above setup, these are the two issues which are faced :

  1. When the replication slot is configured to read change data of root and partition tables, the table name received as part of the raw transaction is the partition name and not the actual root table name(partitioned table) For example :

    • Insert 1 record to public.test_partition
    • Sample transaction object received -> [ tableName : 'public.test_partition_P00', operation : ' INSERT' ..] Query : Why is the received event containing the table name as a partition name(public.test partition_P00) rather than the root table name(public.test partition)?
  2. If the slot is configured only with the partitioned root table(public.test_partition), change data is not captured. Query : Why is the change data not captured in this scenario?

eulerto commented 1 year ago

This is not supported.