View Revisions: Issue #6882

Summary 0006882: Capture TRUNCATE table events in PostgreSQL database
Revision 2025-05-09 18:18 by pbelov
Description The PostgreSQL database supports triggers for TRUNCATE table events.
Currently these events are not being captured by the existing DDL trigger feature.
Revision 2025-05-09 18:39 by pbelov
Description The PostgreSQL database supports triggers for TRUNCATE table events.
Currently these events are not being captured by the existing DDL trigger feature.

The TRUNCATE table event in PostgreSQL is:
* A table-level event (not a row-level or schema-level event).
* Must be implemented via a function or procedure.

Revision 2025-05-09 18:18 by pbelov
Steps To Reproduce
Revision 2025-05-09 18:39 by pbelov
Steps To Reproduce Set up a node with PostgreSQL database as a source.
Set the parameter
trigger.capture.ddl.changes=true

Create a test table :
   CREATE TABLE demo_small(id int);

Configure new SymmetricDS trigger for the demo_small table.

Execute truncate statement:
   TRUNCATE TABLE demo_small;

Observe: No new sym_data records.
Revision 2025-05-09 18:18 by pbelov
Additional Information
Revision 2025-05-09 18:39 by pbelov
Additional Information PostgreSQL docs:
Create Trigger https://www.postgresql.org/docs/17/sql-createtrigger.html
Trigger functions https://www.postgresql.org/docs/current/functions-event-triggers.html
Revision 2025-07-02 13:29 by pbelov
Steps To Reproduce Set up a node with PostgreSQL database as a source.
Set the new start-up parameter
postgres.trigger.capture.truncate.event=true
(the trigger.capture.ddl.changes=true is optional in this case)

Create a test table :
   CREATE TABLE demo_small(id int);

Configure new SymmetricDS trigger for the demo_small table.

Execute truncate statement:
   TRUNCATE TABLE demo_small;

Observe: New sym_data records for the Truncate TAble event.
Revision 2025-07-10 17:13 by pbelov
Description The PostgreSQL database supports triggers for TRUNCATE table events.
Currently these events are not being captured by the existing DDL trigger feature.

The TRUNCATE table event in PostgreSQL is:
* A table-level event (not a row-level or schema-level event).
* Must be implemented via a function or procedure.

New parameter to turn on this feature (is not compatible with log-based replication or PostgreSQL older than version 14):
postgres.trigger.capture.truncate.event
Revision 2025-07-10 17:13 by pbelov
Additional Information Due to issues with trigger rebuilds in versions of PostgreSQL 13 and older, this new feature (Truncate Event capture) is not supported on those versions.

PostgreSQL docs:
Create Trigger https://www.postgresql.org/docs/17/sql-createtrigger.html
Trigger functions https://www.postgresql.org/docs/current/functions-event-triggers.html