Re: Logical decoding truncate

From: Euler Taveira <euler(at)timbira(dot)com(dot)br>
To: "Friedrich, Steffen" <Steffen(dot)Friedrich(at)dieboldnixdorf(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Logical decoding truncate
Date: 2017-05-11 18:25:14
Message-ID: CAHE3wghw80TwbfS+f1FQ07Gp9FhjMBjH4fCGwHmgkVuLC5Ds9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-05-11 4:23 GMT-03:00 Friedrich, Steffen <
Steffen(dot)Friedrich(at)dieboldnixdorf(dot)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>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-05-11 18:31:02 Re: Cached plans and statement generalization
Previous Message Bruce Momjian 2017-05-11 18:15:05 Re: Cached plans and statement generalization