Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPQyM-00086a-II for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Apr 2020 13:23:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPQyL-0007hl-FS for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Apr 2020 13:23:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPQyL-0007he-90 for pgsql-hackers@lists.postgresql.org; Fri, 17 Apr 2020 13:23:57 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPQyI-00023s-85 for pgsql-hackers@postgresql.org; Fri, 17 Apr 2020 13:23:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id B296C5C0281; Fri, 17 Apr 2020 09:23:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Fri, 17 Apr 2020 09:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=lVPmMkAZ2pEMGAyBLKBVfnObhbv/wS3AqRap4zuQu Y8=; b=Ois5BLLu37EeVPrOy8SPQpCof82uVeTbPoNm957f9jNOx7It2s593XU7o HO76UpcqtV/DF8CVaB3hO+d1LGQ0cGCHSanUmnxxZvq7qNJ0s7HHnP1oDupGOoj3 qyQKU+K9ii4i0g8t5mSUm6x93Lrcw7baABU2Ny1Fzky4nZniSr5GbrWHxzqYJqXY tf8ZVcSZlG3jOTIok5dUyzrGarDKe1/SXAKqYvET3aTZAWVRX8qyXeyuP8ZAmvnz +2QC4RMBC3yQqP4Q1WXPbnWW44QHU5lB3yjCMYOsCmVXHHgki+yORrrGNOa5ajDe r6ZyOuKfHcTk4SM3zn6ceYg6cTcAA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrfeejgdeihecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhfhokffffgggjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqh hurggurhgrnhhtrdgtohhmqeenucffohhmrghinhepvdhnughquhgrughrrghnthdrtgho mhenucfkphepleefrddvgedvrddvudefrddvgedunecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhhtsedv nhguqhhurggurhgrnhhtrdgtohhm X-ME-Proxy: Received: from april.pezone.net (p5df2d5f1.dip0.t-ipconnect.de [93.242.213.241]) by mail.messagingengine.com (Postfix) with ESMTPA id 4BDE3328006A; Fri, 17 Apr 2020 09:23:51 -0400 (EDT) Subject: Re: adding partitioned tables to publications To: Amit Langote References: <64a2c1c7-3887-787b-e43b-ac15112bda82@2ndquadrant.com> <21de0e53-0f5f-f31a-2dcb-6e4b35571c94@2ndquadrant.com> <04d78603-edae-9243-9dde-fe3037176a7d@2ndquadrant.com> Cc: Petr Jelinek , Rafia Sabih , PostgreSQL-development From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <3d7d2aef-03ea-158d-d43a-e349df73f879@2ndquadrant.com> Date: Fri, 17 Apr 2020 15:23:50 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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