Re: [PATCH] Logical decoding of TRUNCATE

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: 2018-01-04 11:24:20
Message-ID: CANP8+jKe2MxtH4Ck70tUY6wP=OnkkkXRt8Xkx1u6+50HM2wHvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 29 December 2017 at 19:55, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Hi,
>
> On 2017-12-29 14:15:22 +0100, Marco Nenciarini wrote:
>> This patch implements support for TRUNCATE statements
>> in logical replication. The work has mainly done by Simon Riggs then
>> finished by me. Tests are written by me.
>>
>> TRUNCATE is treated as a form of DELETE for the purpose of deciding
>> whether to publish, or not.
>
> It'd be good if you explained exactly what the chosen behaviour is, and
> why that's the right behaviour in comparison to other alternatives.

At present the patch treats TRUNCATE as if it were a DELETE

which means that

CREATE PUBLICATION insert_only FOR TABLE mydata WITH (publish = 'insert');
will not publish truncates before or after this patch

CREATE PUBLICATION insert_only FOR TABLE mydata;
will now publish TRUNCATEs, although they were ignored in PG10
so PG10 publications will act differently

I had regarded it as a missing piece, but some may view that is a
behaviour change in PG11

Alternatively, we could also use WITH (publish = 'truncate') as a
separate decision.

That is an easy change if we wish it.

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2018-01-04 15:24:13 Re: Pg Upgrade failing as it is not able to start and stop server properly
Previous Message kiran gadamsetty 2018-01-04 08:19:17 Re: Pg Upgrade failing as it is not able to start and stop server properly

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-01-04 11:54:37 Re: Enhance pg_stat_wal_receiver view to display connected host
Previous Message Thomas Munro 2018-01-04 11:11:19 Re: Unimpressed with pg_attribute_always_inline