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 1vVyTi-00ADFk-1G for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 20:50:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVyTg-00GRQB-1v for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2025 20:50:33 +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 1vVyTf-00GRQ2-2S for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 20:50:33 +0000 Received: from fout-b8-smtp.messagingengine.com ([202.12.124.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vVyTd-001IMc-0l for pgsql-hackers@lists.postgresql.org; Wed, 17 Dec 2025 20:50:32 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id 206881D0008A; Wed, 17 Dec 2025 15:50:26 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Wed, 17 Dec 2025 15:50:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc: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=fm2; t=1766004625; x=1766091025; bh=G2nsY8VXd0Nc1Xp8nd4Rr5sKvUUCdIQuc1auZpgXU/w=; b= gviMPhHca4wop8EqPQ44WZ/7KWh3CxyjGVcljzHvb7fUuxiquWf9BT2+oGszLQWw qRo0CQFQMCSg27uLKxm3991DY+imcV0lD8QXD61f/Wgmd0Aig9qK/zXD0VSlpO8q BpDT9akUH3LcbSoC86xOukb0VbWhzq9M8Fyeq1ebtnpSSGLv8XSc+Ngh1Rz6w5bH vU0v3erDvg65Xrx0ywlUUlPamjil18DEmeLQ5ayyq/xGgnX/6dH2CWsAjj4Zc4by OHRlfpdGcNvHRqeWihMwjzKtF2qdLOyK5bAeeT8FFSfvceIYOnhRiFodJMeRLQjc WrxT8UmuxpGVB4xSttAD5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm1; t=1766004625; x= 1766091025; bh=G2nsY8VXd0Nc1Xp8nd4Rr5sKvUUCdIQuc1auZpgXU/w=; b=a 8CxB1e15UUjqDp1kyg7acsicwhAsb6yIVI9YRkY7umjea4WVuivqTdXjRrU25ua2 bWSK+5iWxMoINU5ia9sd8hv1QlCFjNkv/4sJpiprZ81pq/We4U5emeYaNzQCvXfH Ct/2WuVMGSnqvfcrlxDpdQQjyLfl5xkEoHZX4JtNkGRpasYNfpWq9yp1m91yKNcX NFP/oob0yNQlC6dKmhqVrFIS8tniYmMKzbI0mTNoL0loSZ/pkL53XYHq9xa/s7uA uNqeGICf/FNxlfuZlf5ZEksd7nLW6cBVxiRUpprQHBQfNWmvIYiRedvf5xNLCjNZ WooVRcuahCPeRT89cgaAw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegfeehiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvvefkjghfufgtgfesthejredtredttdenucfhrhhomhepfdfguhhlvghr ucfvrghvvghirhgrfdcuoegvuhhlvghrsegvuhhlvghrthhordgtohhmqeenucggtffrrg htthgvrhhnpeefhefgjeehgeelleekgffhteehveehteelffefjefgvddvudeiveehheek jeevueenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdgvnhhtvghrphhrih hsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpegvuhhlvghrsegvuhhlvghrthhordgtohhmpdhnsggprhgtphhtthhopeehpd hmohguvgepshhmthhpohhuthdprhgtphhtthhopehhohhuiihjrdhfnhhsthesfhhujhhi thhsuhdrtghomhdprhgtphhtthhopegrmhhithdrkhgrphhilhgrudeisehgmhgrihhlrd gtohhmpdhrtghpthhtohepughilhhiphgsrghlrghuthesghhmrghilhdrtghomhdprhgt phhtthhopehlihdrvghvrghnrdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhope hpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 943741820054; Wed, 17 Dec 2025 15:50:25 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: ASirQp6p08EV Date: Wed, 17 Dec 2025 17:49:03 -0300 From: "Euler Taveira" To: "houzj.fnst@fujitsu.com" , "Chao Li" , "Amit Kapila" Cc: "Dilip Kumar" , "Postgres hackers" Message-Id: In-Reply-To: References: <5ABD7727-CD22-4112-A186-0E788EE78109@gmail.com> <23A24BFF-18A7-4FE9-AAFA-13E1AA207DD0@gmail.com> 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 Wed, Dec 17, 2025, at 8:09 AM, Zhijie Hou (Fujitsu) wrote: > > And I also prefer using a publication option as it's always beneficial to > minimize unnecessary WAL generation whenever possible. > The ship has sailed a long time ago (version 9.4 to be precise -- commit 07cacba983ef). The row identifier property was defined as an SQL command (ALTER TABLE ... REPLICA IDENTITY) and *not* a publication property. IMO that's the correct design because row identifier is a table property. Extend this concept to a publication property is the wrong direction. It is confusing and complex. Each table needs to say what's its row identifier. The user created a table without primary key. Well, create a primary key. There are dozens of thousands of objects. Use a script. I would suggest a way to disallow or add a warning message while creating the publication or adding new tables, however, the FOR ALL TABLES and FOR TABLES IN SCHEMA were mentioned. There isn't a reliable way to guarantee that a publication with UPDATE and/or DELETE option contains only tables with pk, RI FULL or RI USING INDEX. The fact that there is no rows in the pg_publication_rel for these clauses, makes validating the CREATE/ALTER PUBLICATION commands more difficult. (I prefer deterministic commands and when I saw an object definition saying "including objects created in the future", my first question is: what's the drawbacks and caveats?) I don't think the current behavior is lacking documentation; the REPLICA IDENTITY concept is explicitly in the logical replication chapter [1]. [1] https://www.postgresql.org/docs/current/logical-replication-publication.html -- Euler Taveira EDB https://www.enterprisedb.com/