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 1jMRO5-0005X8-N5 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2020 07:14:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jMRO4-0001x2-2R for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Apr 2020 07:14:08 +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 1jMRO3-0001wm-SH for pgsql-hackers@lists.postgresql.org; Thu, 09 Apr 2020 07:14:07 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jMRO1-0001Ju-W2 for pgsql-hackers@postgresql.org; Thu, 09 Apr 2020 07:14:07 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 52EBA5C019F; Thu, 9 Apr 2020 03:14:04 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 09 Apr 2020 03:14:04 -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=7m+Ra7xqQXP76RzX/I97pCsXcRshfN8vzw+ecT4lA Dw=; b=jA0855EBk15TGD3tLoyE02wzSwfa9eTMoryPW7rInryH8PAH8qaaD/HXv r1dN8avMQeWeAWWX/lwuSduoil9delWSwWnDm5Nmi/C5unCyhTlgl/tkBoYBU6vT 3aUJkRXSGs275+z/i7+PPGA/g0hzwavnU5sFyEY3+NyVzBFpsj4TH/Gk50OdQ0b/ aCf6bU23P6HDif4qdspA7EVZAjDUYzABtq7domkMSNGpVees+q+PUVU6QESEqH0e BPeplJGKm86yMkVkz0ZuoaGcagI0rra6Y8nWwI8PjmGRxVRJIP3JacSf+yD5Ca1R DxZGJs3/FDp/hYyaZGZouXUsp51hg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekgdduudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhohfkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvdhnug hquhgrughrrghnthdrtghomheqnecuffhomhgrihhnpedvnhguqhhurggurhgrnhhtrdgt ohhmnecukfhppeelfedrvdegvddrvddufedrvdegudenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthes vdhnughquhgrughrrghnthdrtghomh 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 3A8453060057; Thu, 9 Apr 2020 03:14:03 -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> Cc: Petr Jelinek , Rafia Sabih , PostgreSQL-development From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <04d78603-edae-9243-9dde-fe3037176a7d@2ndquadrant.com> Date: Thu, 9 Apr 2020 09:14:01 +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 05:39, Amit Langote wrote: > sub_viaroot ERROR: number of columns (2601) exceeds limit (1664) > sub_viaroot CONTEXT: slot "sub_viaroot", output plugin "pgoutput", in > the change callback, associated LSN 0/1621010 I think the problem is that in maybe_send_schema(), RelationClose(ancestor) releases the relcache entry, but the tuple descriptors, which are part of the relcache entry, are still pointed to by the tuple map. 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. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services