2017-05-11 4:23 GMT-03:00 Friedrich, Steffen < steffen.friedr...@dieboldnixdorf.com>:
> 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. [1] https://github.com/2ndQuadrant/bdr -- Euler Taveira Timbira - http://www.timbira.com.br/ PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento <http://www.timbira.com.br>