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 1m3gZl-0001Xx-VW for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jul 2021 15:13:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3gZk-00023V-Hp for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jul 2021 15:13:28 +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 1m3gZk-00023N-A8 for pgsql-hackers@lists.postgresql.org; Wed, 14 Jul 2021 15:13:28 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m3gZd-000682-E3 for pgsql-hackers@lists.postgresql.org; Wed, 14 Jul 2021 15:13:27 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 2F952580B08; Wed, 14 Jul 2021 11:13:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 14 Jul 2021 11:13:20 -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:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=zoLU0AFV4oTo9vMAKT2Rr3woyM5JQlDLYhOl3qNUNik=; b=FYHtwvYy JqDdTQjoy2KqMQFGho+/A5FGPVX2vEZNSw1wLPZFFMqRTVvcg+LGsdpPn4XysppB Ve5KBiqY67DmwGmS6DeN3ZnDhgm8zg3teP2T78Rnds1A9KBqhex/mZaRuex3USeK 95wkeusbnf34KB0G4xUTiyv4pj2tem66vXsSVvq6Ez14VqhsMxWHeXCw9f3Pmkh3 RYy8MnNbAaR9Wpda+vDl/qh9UxRTR1KafOCn6564uVXqY+0c5YcF2SlHNvL6P3/L xqoj2DH2isen5Np/g3YZo9XMCKH4qSByQZ7z185hiIswCNiFQxb14NLVbB7Mo4O0 U2ozi2ZG+6pnhg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudekgdekvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudejveejffejveduudetvdekieeuiedtvdeileefkeevjedu feeguedvjefhueelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 14 Jul 2021 11:13:19 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 22B402A038C; Wed, 14 Jul 2021 11:13:16 -0400 (-04) Date: Wed, 14 Jul 2021 11:13:16 -0400 From: Alvaro Herrera To: Tomas Vondra Cc: Dilip Kumar , Amit Kapila , Euler Taveira , Peter Smith , Rahila Syed , Peter Eisentraut , =?utf-8?B?w5ZuZGVyIEthbGFjxLE=?= , japin , Michael Paquier , David Steele , Craig Ringer , Tomas Vondra , Amit Langote , PostgreSQL Hackers Subject: Re: row filtering for logical replication Message-ID: <202107141513.hgtsvjpkbqfe@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4da2b027-4f80-f31f-1d06-6498e9760c2e@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Jul-14, Tomas Vondra wrote: > On 7/14/21 4:52 PM, Alvaro Herrera wrote: > > In any case, it seems to me that the condition expression should be > > scanned to see which columns are used in Vars (pull_varattnos?), and > > verify if those columns are in the REPLICA IDENTITY; and if they are > > not, raise an error. Most of the time the REPLICA IDENTITY is going to > > be the primary key; but if the user wants to use other columns in the > > expression, we can HINT that they can set REPLICA IDENTITY FULL. > > Yeah, but AFAIK that's needed only when replicating DELETEs, so perhaps we > could ignore this for subscriptions without DELETE. Yeah, I said that too in my older reply :-) > The other question is when to check/enforce this. I guess we'll have to do > that during decoding, not just when the publication is being created, > because the user can do ALTER TABLE later. ... if you're saying the user can change the replica identity after we have some publications with filters defined, then I think we should verify during ALTER TABLE and not allow the change if there's a publication that requires it. I mean, during decoding we should be able to simply assume that the tuple is correct for what we need at that point. -- Álvaro Herrera Valdivia, Chile — https://www.EnterpriseDB.com/