I am writing a logical decoding output plugin decoding WAL to SQL which is finally applied to target database.
Is it possible to decode a TRUNCATE statement and the tables involved?
Yes, use event triggers. You can decode whatever DDL command you want.
Assuming the SQL statement "TRUNCATE x, y;", I am interested in decoding the operation TRUNCATE and the corresponding tables x and y so that I can reconstruct the SQL statement/transaction.
Is that possible?
If so, can you please provide an example or point me into the right direction?
Take a look at BDR code (bdr_queue_ddl_commands and bdr_queue_dropped_objects) [1]. It implements DDL replication too.