Postgres How to Delete Records From the Recipient Table of "Insert Into"

Viewed 20

I have table A and table B. Every five minutes I sync table A into Table B using

insert into B (col_1) select col_1 from A on conflict do update A.col_1 = B.col_1

This works great to keep B up to date with A. Except it's possible that A has a record, then it gets inserted into B, and then deleted from A.

How can I ensure B does not contain any records that are not in A?

1 Answers
Related