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 1nEQsv-0000hO-LC for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jan 2022 07:13:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nEQsu-0008Hc-GD for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jan 2022 07:13:56 +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 1nEQsu-0008HT-5v for pgsql-hackers@lists.postgresql.org; Mon, 31 Jan 2022 07:13:56 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEQsq-0002Pc-8G for pgsql-hackers@postgresql.org; Mon, 31 Jan 2022 07:13:55 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id E2AC05C00C8; Mon, 31 Jan 2022 02:13:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 31 Jan 2022 02:13:50 -0500 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; bh=BaXG5FIXscM9Cfb/R55hoCjrqFHGgvshrDcEJUCe/ W4=; b=Hkdq9z7aLoHfVu8IBXNQnWhxKjzgV/UTPlmd/cNmsJBFsRignFzOe73iY E3pejtnXA+akmSh2tfXvXosNmrxG00URy2QmYZi/CPnJVpnNSYgWvYJubna4CF1D KahzaaodNntp3YgQIX9UOYjYOUDaaAz08nhCIIV81Mmfjp9qdv3IxKn0h5SgwUH6 q7oJl9a+hBaXejDSvdiqPJ0uvC5DmV3Fdq4xDdmgcDqCK2fl5tIVcM1xVs741FLk /6dcun4DeSG/hSNq+QMx1qknp8BjTFV1mu3UJdW75+nYnIjw/1101EYyLHpWlYfL V6nrXKk8jbWnsbhmdxj4bU2iklMwg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrgedtgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgvthgv rhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnhhtvg hrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepfeejgeehteeuhfevvedu leeufedtjeetiefftedvudfhtdeifefgueettdevgefgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgruhht segvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 31 Jan 2022 02:13:49 -0500 (EST) Message-ID: Date: Mon, 31 Jan 2022 08:13:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Column Filtering in Logical Replication Content-Language: en-US To: Alvaro Herrera Cc: Justin Pryzby , Tomas Vondra , Amit Kapila , "houzj.fnst@fujitsu.com" , Rahila Syed , Peter Smith , pgsql-hackers@postgresql.org References: <202201120041.p24wvsfcsope@alvherre.pgsql> From: Peter Eisentraut In-Reply-To: <202201120041.p24wvsfcsope@alvherre.pgsql> 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 12.01.22 01:41, Alvaro Herrera wrote: > I discovered a big hole in this, which is that ALTER PUBLICATION SET > (publish='insert,update') can add UPDATE publishing to a publication > that was only publishing INSERTs. It's easy to implement a fix: in > AlterPublicationOptions, scan the list of tables and raise an error if > any of them has a column list that doesn't include all the columns in > the replica identity. Right now, we are not checking the publication options and the replica identity combinations at all at DDL time. This is only checked at execution time in CheckCmdReplicaIdentity(). So under that scheme I don't think the check you describe is actually necessary. Let the user set whatever combination they want, and check at execution time if it's an UPDATE or DELETE command whether the replica identity is sufficient.