Re: [HACKERS] Logical decoding truncate - Mailing list pgsql-hackers

From Euler Taveira
Subject Re: [HACKERS] Logical decoding truncate
Date
Msg-id CAHE3wghw80TwbfS+f1FQ07Gp9FhjMBjH4fCGwHmgkVuLC5Ds9A@mail.gmail.com
Whole thread Raw
In response to [HACKERS] Logical decoding truncate  ("Friedrich, Steffen" <Steffen.Friedrich@dieboldnixdorf.com>)
List pgsql-hackers
2017-05-11 4:23 GMT-03:00 Friedrich, Steffen <Steffen.Friedrich@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.
--
   Euler Taveira                                   Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Cached plans and statement generalization
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Cached plans and statement generalization