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 1vgJk1-00AqVm-0T for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Jan 2026 09:34:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vgJk0-00G1gu-12 for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Jan 2026 09:34:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vgJjz-00G1gl-1x for pgsql-hackers@lists.postgresql.org; Thu, 15 Jan 2026 09:34:08 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vgJjx-000XWd-0d for pgsql-hackers@lists.postgresql.org; Thu, 15 Jan 2026 09:34:06 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id E0B6D1D000F0; Thu, 15 Jan 2026 04:34:04 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 15 Jan 2026 04:34:05 -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=1768469644; x=1768556044; bh=WW2eItj9BR vYCOLPiTfh+eOBxnPJ2txItXjh4RJHJEY=; b=bBDtYc+ojRDvMDnE5g85NE5CD3 gxQX+hhI8r4L3JEG1OAB23b8bx4V5//P/sHuLjnSza+y7R9WfIs/GdO8IlppwdS6 ekpsE+2+O507c28ecX2906VYJbvmFS2cR7FeaM8dRb2a7c9OHv/RqcZ8X5U5n+kR e5WZArO7sQoE8Orgve6adR8YGZcP4rCDZSq/lE+tK13uK6+jEQDtNR/MfYuGZO2f 5nGm3kT5f27CEnBW69jWsXsnhBoNPQ2ZzR45ehJNCEyrsbjLxwndoW4KBrfpevo5 Fa7FloYWtvXv8zlaiS29ds1yL4dPNzM1pArZUNKU6Eat3fz9lvzzWXdqmotQ== 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= 1768469644; x=1768556044; bh=WW2eItj9BRvYCOLPiTfh+eOBxnPJ2txItXj h4RJHJEY=; b=c25EJnnXHY3Y1RPnyVlmWrLL3LQMFpvf6oxR0Q1b8QP+6hkkz8o TvgH//7thUOO+LD/izdyP0AJnEDvIsDk2bQZyLvxESZ3yas9W4H9bSGEiIgi9ZAJ wFeNHEPnrhIQMVd9Gy4VmsSSpdKOW+VZ08Zc7nb5v/AcV3vBLyLpdWLMjBQU9TFw pwe0+BHLqFeh9m2Vttyv3ZGVe6Z+9gEz4t1CJ9vm3ZzWZkUFtQAWyGrplSUQOPtF Lw2pOKelKBYJzxa1L9pM8KqFsjVVWUP4Ef1mAFDn9k6uX/Sdnk9gN39wS6pf4U5V bSmSJskDpJUoqnOuYUCIX0iCsjRx99d0mlg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdehjeduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheptghorh gvhidrhhhuihhnkhgvrhesghhmrghilhdrtghomhdprhgtphhtthhopehtnhgurhifrghn ghesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlih hsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 15 Jan 2026 04:34:03 -0500 (EST) Date: Thu, 15 Jan 2026 18:33:59 +0900 From: Michael Paquier To: Corey Huinker Cc: Tender Wang , PostgreSQL Hackers Subject: Re: Extended Statistics set/restore/clear functions. Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="YYS7kEwlPIpOZeHu" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --YYS7kEwlPIpOZeHu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 15, 2026 at 03:59:27AM -0500, Corey Huinker wrote: > Correct, that was done in the v7 patchset to conform to 688dc6299a5b. >=20 > All four names are available through pg_stats_ext, so the additional > requirements for pg_dump may not be a an issue. However, I do have some > vague memory that all four names was a problem in some way beyond just > giving the parameters more chances to disagree with reality. We'll find o= ut > soon enough... I don't see how providing the four arguments would be an incorrect thing to do. We must do the Rangevar lookup first anyway and ensure that a lock is taken on the relation before opening the catalog. Or we would do the opposite of what VACUUM does when updating the stats. That would also be the opposite of what we do for the relation and attribute stats. As you say, these calls will be integrated in pg_dump and pg_upgrade, but I want these to be right from the start for cases where these functions are called outside these contexts, like the other clear/restore functions. Perhaps that could be made lighter, but at least what I have sent has a safe ordering, and we would rely on a single path for the table lookup and the ACL checks. The key point to me is that one cannot drop an extended stats object while we lock the table, looking at the table OID from the pg_stats_ext catalog leads to more complicated code. FWIW, I had a lot of fun today testing a lot of concurrent cases to find out that everything I could think of was actually unsafe without a proper lock taken first on the table, before touching the stats, with the lock remaining until the transaction that calls the function and touches the stats commits, releasing the lock. -- Michael --YYS7kEwlPIpOZeHu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmlotIcACgkQnvQgOdby QH3cGw/+IEB0pzJtgg1D1S0vGVeBHLsajJZZxR2mpiU5jr06YmyyPqyUYGb/llqk R2PSemsfGHxFhiKt/dhJpMSgnFzqhq6WPq8K+Ff6EddAShjbXO2qAZ52JUPXICIU cj4R7/2h120crf+3mv/TyieXQeVfRCIVdkIbwlk0Sz9cO52IsebR5TCMTxuFWnEf PxSMyYGHF3WlhoK+KxbPmctJhY18WibYPKdrh+Qwf/Q6vtP5RaQvmnYFEVEgU3xQ mlsd2BpP1EMFyvB4LAs4WyOvspNt/RfIkNRTLa8bN72WivxjD+ysydUAY6f6RZoz 29LEu6wL0xOfzasCgSIn3urYTcMoZdbUgASwRlfgY/aJkzfn3rxcLbbtw2cHEUjt T4p5CskqTXuSGjzK3EzoBsfijDcIY92aY/OpGJ3WBAwftcMR+/xsk/FIAP74g0KF 9evpfmqjaPKOcjPHmkRKKSwRWHjHYQcsB2WC4hv8uaTu4jZmfF/OcTiDDLEEplhV TfObMPYhutv27ZZPLoESPwCrqIC1zfPOpyRz0KSPYo6cDzaTBfZvURalWuFEsNV/ RUHVKjA95c9nQB+P3aFnJYi4Ho0WD5dL7h6TSXUE1BsOBYolzoZaOyze6qjSMJBi +QnVqxweAVIcKgrXXD3K1QW8AkG9Aweor1cA5Oukw8lsjSQBvG8= =vPpm -----END PGP SIGNATURE----- --YYS7kEwlPIpOZeHu--