Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vInBp-00Eb5k-0E for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 12:09:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vInBm-005v9F-10 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 12:09:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vInBl-005v97-2B for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 12:09:34 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vInBi-0079ZX-2a for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 12:09:33 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 74D137A012A; Tue, 11 Nov 2025 07:09:28 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Tue, 11 Nov 2025 07:09:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1762862968; x=1762949368; bh=l/slOIQ1LBhZyA6E1rQCl2dX7E+g06k16EL0SQ/jFoo=; b= D4m7ijVrvbQm+wT470IPEuHOy+jONEEQrkEBKLwaEtRehG3ih1hxdqwVchlm5DdQ diojEafXoagJVf5JTWuXrdFkFe8OM+TsDSvSr/UuqdX6fZ3dn73tuG2Q+HtZ5Ni6 j2AeW4sLDPaiLuLqwNDaQNgMGe0MDu8yzuNfRJ51t5OB5c7Q7xmuiVKCIWns/6ch yPNuXMiCXqnywxUG0UVT7kX7UItW9enUvEdbkTvAWKn6NS9yFVUu28VyDj/Xqzq1 EdpaYVmyRvUAu+uj27zfqHx6eqeDPjGYHhNv9jTZEDhSqjd3/yBLVwNC/fpJkNq0 GNFo7KC+AuzIzFk1C6tBEQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1762862968; x=1762949368; bh=l /slOIQ1LBhZyA6E1rQCl2dX7E+g06k16EL0SQ/jFoo=; b=UytwE5XY5Im7yQF8m Wxi0jSfowQtT32g2SRVmkY0GnaToQ1TMQpXp6aec2rZng5M3D4+pHhFuG3xkkpv7 o7d7MDsbjHFjaj8xJpdRXHKUlMEMCcypEYLnlzz47+g4ccTkYyaK1muw2srsIX6M tYdtwXJOsgA4TFn1EFNLMV9VnoVKxdwznX44rX4gJIaitoIjHlaG1LLUcdIaNB5N AT8k99mIt7gWm+lSHX2pXXRiZoDg3OUI1Ixs88yCYQZk5dgBEr83huVm7Aa3fEFD BhFFScZLXpF45JljnA24R6m+44DQoUOMgT4owgKsw9ziVTx63GgmgfuhZhZ47huk Yd4nQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvtdduudehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfguhhlvghr ucfvrghvvghirhgrfdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtffrrg htthgvrhhnpeekvdekudfgffelieffledvkeehjedvueevtdejieejkeelffdtudefueek keelgfenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvghulhgvrhesvghulhgv rhhtohdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtoheplhhirdgvvhgrnhdrtghhrghosehgmhgrihhlrdgtohhmpdhrtghpthhtohep phhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id D9FCA1820054; Tue, 11 Nov 2025 07:09:27 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: ASirQp6p08EV Date: Tue, 11 Nov 2025 09:09:02 -0300 From: "Euler Taveira" To: "Chao Li" , "Postgres hackers" Message-Id: In-Reply-To: References: Subject: Re: Improve logical replication usability when tables lack primary keys Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 10, 2025, at 5:06 AM, Chao Li wrote: > I evaluated a few approaches and am proposing the following: > > - Introduce a new GUC: `logical_replication_fallback_to_full_identity`. > - When enabled, if a table being logically replicated has no primary > key, the system automatically uses `REPLICATION IDENTITY FULL` for that > table. > - This setting can be applied at the database level, so large systems > do not need to enable it cluster-wide unless desired. > - When the WAL sender transmits relation metadata, if fallback has > occurred, it explicitly reports `FULL` as the replication identity to > the subscriber, so there is limited impact on the subscriber. > If I understand your proposal correctly, you want to add a new fallback to replica identity. We already have a fallback for DEFAULT that means no primary key is the same as NOTHING. I didn't like your proposal. It is too restrictive. However, I see some usefulness in introducing a GUC default_replica_identity. The proposal is similar to access method (default_table_access_method). The DEFAULT option selects the replica identity sets as default_replica_identity parameter. You need to add a new option (PRIMARY KEY); that should be the default value. (If we don't want to break the backward compatibility, this new option should fallback to NOTHING if there is no primary key. Another alternative is to have a strict and non-strict option. I prefer the former.) Of course, the USING INDEX option cannot be used. For pg_dump, you need to use SET command to inform the default_replica_identity value so tables with the same option as default_replica_identity doesn't emit an ALTER TABLE command. -- Euler Taveira EDB https://www.enterprisedb.com/