Re: [PATCH] Logical decoding of TRUNCATE

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Logical decoding of TRUNCATE
Date: 2018-01-22 22:18:20
Message-ID: f6352c33-f3e3-0e35-dbd2-29949b9c2b59@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 22/01/18 19:45, Petr Jelinek wrote:
> On 19/01/18 12:37, Marco Nenciarini wrote:
>> Hi All,
>>>>> + /* logicalrep_rel_close call not needed, because ExecuteTruncateGuts
>>>>> + * already closes the relations. Setting localrel to NULL in the map entry
>>>>> + * is still needed.
>>>>> + */
>>>>> + rel->localrel = NULL;
>>>>
>>>> This is somewhat ugly. Perhaps the ExecuteTruncateGuts should track
>>>> which relations it opened and only close those and the rest should be
>>>> closed by caller? That should also remove the other ugly part which is
>>>> that the ExecuteTruncateGuts modifies the input list. What if caller
>>>> wanted to use those relations it sent as parameter later?
>>>
>>> Agreed
>>>
>>
>> Attached a new version of the patch addressing these issues.
>>
>
> Besides the small thing I wrote for the 0001 in the other thread I am
> pretty much happy with this now.
>

Actually on second look, I don't like the new boolean parameter much.
I'd rather we didn't touch the input list and always close only
relations opened inside the ExecuteTruncateGuts().

It may mean more list(s) but the current interface is still not clean.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2018-01-22 22:35:13 Re: Changing locale/charset
Previous Message Michael Krüger 2018-01-22 22:11:07 Re: Slow alter sequence with PG10.1

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2018-01-22 22:38:23 Re: [HACKERS] [PATCH] Generic type subscripting
Previous Message Stephen Frost 2018-01-22 22:15:43 Re: [HACKERS] PoC plpgsql - possibility to force custom or generic plan