Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXKq8-0006Ug-NO for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Nov 2019 07:55:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXKq7-0007qG-AC for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Nov 2019 07:55:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXKq6-0007q9-TY for pgsql-hackers@lists.postgresql.org; Wed, 20 Nov 2019 07:55:51 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iXKpz-0005gB-7u for pgsql-hackers@postgresql.org; Wed, 20 Nov 2019 07:55:49 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 273E622440; Wed, 20 Nov 2019 02:55:42 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 20 Nov 2019 02:55:42 -0500 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=fm1; bh=i25AehGJoCOASlqLJxPy0mdwNGmPPYxwa/I3cXRUO V0=; b=mYlW+IVe1bwA3xUry2xh9ex26T/WbuyoD1EDkajTeZdDLpnJBq05HDfS8 ZNjGz3NktVQRas89WqL0B8p4cCqHmTBPt31lXvH7Yt7HRlnNthIRdpvMMN+dhiIb yY0eWX6qBdRAZjt5pqaeHARRrPyNVlbCb36YOGNl4l9fnbD7hPKjusxleG3cCFnQ eQ/obA5orTbScYeKY+BuhfezYhGwQiBfva+zETNKhjAhhyPB+2YyCYhii3Sjm0z5 LMBX1HsHCJ1gqAOzPForWvoFTblG4AdmXQr3e6wXT0sm+/pJjxOgZncpmv0Hpq22 jLiHPguIa2RR0jfeETGRbr5qTZozw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudegledguddufecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhfhokffffgggjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsedvnh guqhhurggurhgrnhhtrdgtohhmqeenucffohhmrghinhepvdhnughquhgrughrrghnthdr tghomhenucfkphepleefrddvgedvrddugeejrdejleenucfrrghrrghmpehmrghilhhfrh homhepphgvthgvrhdrvghishgvnhhtrhgruhhtsedvnhguqhhurggurhgrnhhtrdgtohhm necuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from april.pezone.net (p5df2934f.dip0.t-ipconnect.de [93.242.147.79]) by mail.messagingengine.com (Postfix) with ESMTPA id 3B7A93060061; Wed, 20 Nov 2019 02:55:41 -0500 (EST) Subject: Re: adding partitioned tables to publications To: Amit Langote References: <037d3133-1689-108c-360d-b782e3209cfb@2ndquadrant.com> Cc: Rafia Sabih , PostgreSQL-development From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Wed, 20 Nov 2019 08:55:39 +0100 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 2019-11-18 09:53, Amit Langote wrote: > I have spent some time hacking on this. With the attached updated > patch, adding a partitioned table to publication results in publishing > the inserts, updates, deletes of the table's leaf partitions as > inserts, updates, deletes of the table itself (it all happens inside > pgoutput). So, the replication target table doesn't necessarily have > to be a partitioned table and even if it is partitioned its partitions > don't have to match one-to-one. > > One restriction remains though: partitioned tables on a subscriber > can't accept updates and deletes, because we'd need to map those to > updates and deletes of their partitions, including handling a tuple > possibly moving from one partition to another during an update. Right. Without that second part, the first part isn't really that useful yet, is it? I'm not sure what your intent with this patch is now. I thought the previous behavior -- add a partitioned table to a publication and its leaf tables appear in the replication output -- was pretty welcome. Do we not want that anymore? There should probably be an option to pick the behavior, like we do in pg_dump. What happens when you add a leaf table directly to a publication? Is it replicated under its own identity or under its ancestor partitioned table? (What if both the leaf table and a partitioned table are publication members?) -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services