Hi Team,
I would like to know how we can handle FK constraints while replicating postgres database using Debezium.
For example, I have two identical databases running in different PostgreSQL servers. When I do inserts in two different tables with FK constraints: Product and Merchant, first I must insert Merchant then Product,
how will it be executed by the Debezium connector for PostgreSQL? Will it execute first the parent inserts and then the child?
Debezium doesn't guarantee the order, because it has two different tables and the events will be sent to different Kafka topics, but if it was executed in different orders by the postgres connector then it will result in a Foreign Key constraint Exception.
How we can handle this kind of situation?
Note: We are using Debezium connector for PostgreSQL as Source connector and kafkaJS consumer for consuming change events.