Re: adding partitioned tables to publications

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Petr Jelinek <petr(at)2ndquadrant(dot)com>, Rafia Sabih <rafia(dot)pghackers(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: adding partitioned tables to publications
Date: 2020-04-17 13:23:50
Message-ID: 3d7d2aef-03ea-158d-d43a-e349df73f879@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-04-09 09:28, Amit Langote wrote:
>> This patch makes the tests pass for me:
>>
>> diff --git a/src/backend/replication/pgoutput/pgoutput.c
>> b/src/backend/replication/pgoutput/pgoutput.c
>> index 5fbf2d4367..cf6e8629c1 100644
>> --- a/src/backend/replication/pgoutput/pgoutput.c
>> +++ b/src/backend/replication/pgoutput/pgoutput.c
>> @@ -305,7 +305,7 @@ maybe_send_schema(LogicalDecodingContext *ctx,
>>
>> /* Map must live as long as the session does. */
>> oldctx = MemoryContextSwitchTo(CacheMemoryContext);
>> - relentry->map = convert_tuples_by_name(indesc, outdesc);
>> + relentry->map =
>> convert_tuples_by_name(CreateTupleDescCopy(indesc),
>> CreateTupleDescCopy(outdesc));
>> MemoryContextSwitchTo(oldctx);
>> send_relation_and_attrs(ancestor, ctx);
>> RelationClose(ancestor);
>>
>> Please check.
>
> Thanks. Yes, that's what I just found out too and was about to send a
> patch, which is basically same as yours as far as the fix for this
> issue is concerned.

I have committed my patch but not ...

> While figuring this out, I thought the nearby code could be rearranged
> a bit, especially to de-duplicate the code. Also, I think
> get_rel_sync_entry() may be a better place to set the map, rather than
> maybe_send_schema(). Thoughts?

because I didn't really have an opinion on that at the time, but if you
still want it considered or have any open thoughts on this thread,
please resend or explain.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2020-04-17 13:24:35 Re: Lexer issues
Previous Message Tom Lane 2020-04-17 13:22:16 Re: Support for DATETIMEOFFSET