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 1vkdfy-000TUR-0l for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jan 2026 07:39:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vkdfx-00CbY2-0i for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jan 2026 07:39:49 +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 1vkdfw-00CbXu-1r for pgsql-hackers@lists.postgresql.org; Tue, 27 Jan 2026 07:39:49 +0000 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vkdft-00000000feu-4A1B for pgsql-hackers@lists.postgresql.org; Tue, 27 Jan 2026 07:39:48 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 6502BEC022A; Tue, 27 Jan 2026 02:39:43 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 27 Jan 2026 02:39:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=1769499583; x=1769585983; bh=+Olyb+IE7t 2t66zAbl6NlZbu+dEsJ/U+s9sQx74ZFug=; b=KdJhL4UIx5YrX+Q6eNApDntA/m 5fXKMdTFdBWlzUIqAEKMjlpeyNBVgSpmRy/bmmtUGC0SorKqiAHqCm9S0b1u1Ia9 i7cw+pn4/o+ccO0H+hgt96R+GhlmCeuo/F2J7sHTMkFAH7lueK5gWs0CUafZpK3j O80hBsX/PvgcmbXAdG7O1zosrooIATw+/RglAHQQb7ehsENDW+TEsa4ekxWlqnlh JxhrUvHCpMkqxNfXfTN4lC5hGViJg2Mh9rmevUm2NjtxX+wFCO3GxTWG09tMiO5O Ym5FuScSXdtrHEs5L263seuFzDPx+yyyCiTtK9nu574QtAnFnO4q9SvLceBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=fm2; t= 1769499583; x=1769585983; bh=+Olyb+IE7t2t66zAbl6NlZbu+dEsJ/U+s9s Qx74ZFug=; b=SMncg/br4YKPWvCkH7BUIgQFQgZsXgnjHm9QoNAU5Lpsu5V/nep wUvFIx4e5Cj1gkUv91NvEhtzOsU3LyHLE/tHyAcz/1ovvwei/ZOPdbykUHJG2x3w gLvKQOfvr29vuWVslUvYZpIZw1S0ZC0oUvDgFgvGwBdDcYHFfHWbgQaChbSsnC5T ZbfdIyZoNxRmUP6up+VUn6yikFfNOM63RuzHkiylRHkOaeDApeKsL7sAHqdExbKp qhTJ0Ss7CRCDXrIKer0tqnL24cPEuBplvu9Fd7WjXytJKS+LLkg7dC5d78JItmDE X2M63Shz64MoA+NYIuGFUOyVI2H1x30LUuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduheelleehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheplhhird gvvhgrnhdrtghhrghosehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgr tghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 27 Jan 2026 02:39:41 -0500 (EST) Date: Tue, 27 Jan 2026 16:39:36 +0900 From: Michael Paquier To: Chao Li Cc: Postgres hackers Subject: Re: tablecmds: fix bug where index rebuild loses replica identity on partitions Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="73ebjfTpGitdFry+" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --73ebjfTpGitdFry+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 27, 2026 at 01:13:32PM +0800, Chao Li wrote: > I found this bug while working on a related patch [1]. >=20 > When ALTER TABLE ... ALTER COLUMN TYPE causes an index rebuild, and > that index is used as REPLICA IDENTITY on a partitioned table, the > replica identity marking on partitions can be silently lost after the > rebuild.=20 I am slightly confused by the tests included in the proposed patch. On HEAD, if I undo the proposed changes of tablecmds.c, the tests pass. If I run the tests of the patch with the changes of tablecmds.c, the tests also pass. These tests don't check what you want them to. - if (tab->replicaIdentityIndex) + if (tab->replicaIdentityIndexOids !=3D NIL) elog(ERROR, "relation %u has multiple indexes marked as replica id= entity", tab->relid); This looks wrong to me. This new list tracks the OIDs of indexes where you'd want to make sure that relreplident is updated, and it could be possible, based on your proposal, that multiple indexes are stored in this list. The error message is at least not in line anymore. Actually, do we really need this extra list at all? The list of indexes to rebuild are tracked already in changedIndexOids, and the partitioned indexes seem to be in it, no? -- Michael --73ebjfTpGitdFry+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAml4a7gACgkQnvQgOdby QH1h/Q/+K38ub3fVEo+0phQ2+erpBtKyf4Il5bOM3nayneMVt8LLAeOT3dIp/UjG yn84px+B4YcHMFThK+Li9gcg3bL0fv77w/33P+gLEOm2zNUlDNrqfZqrB1cScm6w B+1jgXU77bqex5CV/77wdpF/2mzE/db/xX2uL0LHB6yv0nxoyoi0APpSApk4zrmv nU0gXRye9oRwQGNAM/7g+g5xV3ez0+ObLzzCEDBKv6FL4PHWj+FWV2zY1Q7wz7Cl 0727x7kTUeGp7UReiY6yAZy0HI2xA30XxMRxuQiRttHA+zNMZuRc+PRJD+Zfe+0B 4mBCCi241HgndNt++MnhoYeYsGb6JFt+aRCFDmzbmSZQXbHEIHFvCg6Q3Ic/AkKZ xKELmIyVtYPn0sqtWwAe2U2sawlLzw1mhYDPhNDYn6576MALLyGnec19ueYZZ1qv dVJ3RrOlIPiV6Vz1SO7AitCrlkv1C968hpMLIq/WQwf3DmkyOkooVPrtqUYdaK4i zFXA0OvSibm9llF48VRjZB/G0EtLhaaPp3GhR3aTL7xUqziuY/zcXMJugmIPxpe2 72hfM7Ys5HwT3aa9DOV/K2sS6n87wKRN9o8bFYpNTz8wW+P4cWMPvxcdAWfSYkTg by0YqvMzFNr5PbNy+kvLddtheUIjLUC35mcBteGX8okq+8vO5FY= =AcMc -----END PGP SIGNATURE----- --73ebjfTpGitdFry+--