BUG #14771: "Logical decoding" does not cover the impact of "TRUNCATE TABLE" command

From: hillel(dot)eilat(at)attunity(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Cc: hillel(dot)eilat(at)attunity(dot)com
Subject: BUG #14771: "Logical decoding" does not cover the impact of "TRUNCATE TABLE" command
Date: 2017-08-07 12:20:30
Message-ID: 20170807122030.8422.9419@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14771
Logged by: Hillel Eilat
Email address: hillel(dot)eilat(at)attunity(dot)com
PostgreSQL version: 9.4.4
Operating system: Windows 7
Description:

I work on a mission of synchronizing data between PostgreSQL database and a
"foreign" target database of choice.
A simple SQL based "Logical Decoding" framework is used for capturing
"INSERT,UPDATE,DELETE" operations which are applied on the PostgreSQL
side.
These are applied onto the target DB thereafter - thus - both sides remain
intact with respect to their data contents.
Yet - this synchronization pattern does not cover the case of "TRUNCATE
TABLE" command.
From "Logical Decoding" perspective - "TRUNCATE TABLE" is logically
equivalent to "DELETE FROM TABLE".
Both affect the contents of the PostgreSQL database identically.
However - "DELETE FROM TABLE" will be reflected at the target database
properly - as expected - while "TRUNCATE" will NOT!!.
"Logical Decoding" aims to cover ALL changes made onto data in a coherent
fashion.
"TRUNCATE" stands for a case where change in data contents at PostgreSQL are
not handled by "Logical Decoding", hence synchronization is not achieved.
Did I miss something?
Is it the only case?
How can one cope with this deficiency?

Regards

Hillel.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Euler Taveira 2017-08-07 13:03:20 Re: BUG #14771: "Logical decoding" does not cover the impact of "TRUNCATE TABLE" command
Previous Message Jaimin Pan 2017-08-07 07:45:16 Error of insert Foreign table with postgres_fdw