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 1nlcl7-0001K4-Vo for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2022 20:35:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nlcl4-0003r7-Lz for pgsql-hackers@arkaria.postgresql.org; Mon, 02 May 2022 20:35:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlcl3-0003pA-Da for pgsql-hackers@lists.postgresql.org; Mon, 02 May 2022 20:35:02 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlckv-0001y1-9c for pgsql-hackers@lists.postgresql.org; Mon, 02 May 2022 20:34:59 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DE8395C00CF; Mon, 2 May 2022 16:34:51 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 02 May 2022 16:34:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1651523691; x=1651610091; bh=+/iPokuahbTdL TLpMt/7UQI+RiuiT7bTjdFAEa/SIpg=; b=Sqax1CG+0yEkG800OK9dcPFlIyrE1 B+YAd/lkTrdhDfnJP3ieX4ABdShBy4IjSDAgp7+tCk1Mby1M72KOofYq31U432Rp mJSa2Ki1N1HtxvuvjH23h+w98BwtjF82Ins6k0qnfzQWaACuSEC3h9UUpTGLuY9V UyC7e3Sw3nr9ErYyxC8ZaF02lf5VCZcEpI0gxZK3bc57J/BXUdl1WaZOF1l7Z/8T 9Q7e18AHtVVnst1TEGYbCd2b3rOyhTJiwcNEr2+oQP+OnUIQSZlGK5GL76qB9gDW pbs7/8ia0Of7gyvblyK6B1ZdI7e3ZKNS2gdqXrIGu2ctkK+OG1K0H4eyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdehgdduhedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeehleffgeegudejteei hfelteduvdeifffhffdvjedvffegjeekudeludehudeifeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 2 May 2022 16:34:50 -0400 (EDT) Message-ID: <47dd2cb9-4e96-169f-15ac-f9407fb54d43@enterprisedb.com> Date: Mon, 2 May 2022 22:34:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: bogus: logical replication rows/cols combinations Content-Language: en-US To: Tomas Vondra , Amit Kapila Cc: Alvaro Herrera , Pg Hackers References: <006d5ffc-1e7a-5cf2-c507-88eee6e0c14d@enterprisedb.com> <202204270943.4ol7indtwv3i@alvherre.pgsql> <39077967-c327-eddb-ac4b-7d64117944fb@enterprisedb.com> <338e719c-4bc8-f40a-f701-e29543a264e4@enterprisedb.com> From: Peter Eisentraut In-Reply-To: <338e719c-4bc8-f40a-f701-e29543a264e4@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 01.05.22 23:42, Tomas Vondra wrote: > Imagine have a table with customers from different regions, and you want > to replicate the data somewhere else, but for some reason you can only > replicate details for one particular region, and subset of columns for > everyone else. So you'd do something like this: > > CREATE PUBLICATION p1 FOR TABLE customers (... all columns ...) > WHERE region = 'USA'; > > CREATE PUBLICATION p1 FOR TABLE customers (... subset of columns ...) > WHERE region != 'USA'; > > I think ignoring the row filters and just merging the column lists makes > no sense for this use case. I'm thinking now the underlying problem is that we shouldn't combine column lists at all. Examples like the above where you want to redact values somehow are better addressed with something like triggers or an actual "column filter" that works dynamically or some other mechanism. The main purpose, in my mind, of column lists is if the tables statically have different shapes on publisher and subscriber. Perhaps for space reasons or regulatory reasons you don't want to replicate everything. But then it doesn't make sense to combine column lists. If you decide over here that the subscriber table has this shape and over there that the subscriber table has that other shape, then the combination of the two will be a table that has neither shape and so will not work for anything. I think in general we should be much more restrictive in how we combine publications. Unless we are really sure it makes sense, we should disallow it. Users can always make a new publication with different settings and subscribe to that directly.