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 1vkb6n-00HUNQ-0P for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jan 2026 04:55:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vkb6l-00BxxA-2b for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jan 2026 04:55:20 +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 1vkb6k-00Bxx2-2y for pgsql-hackers@lists.postgresql.org; Tue, 27 Jan 2026 04:55:19 +0000 Received: from fhigh-b6-smtp.messagingengine.com ([202.12.124.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vkb6i-00000000eVM-1MzJ for pgsql-hackers@lists.postgresql.org; Tue, 27 Jan 2026 04:55:18 +0000 Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfhigh.stl.internal (Postfix) with ESMTP id D75A27A01A4; Mon, 26 Jan 2026 23:55:13 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Mon, 26 Jan 2026 23:55:14 -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=1769489713; x=1769576113; bh=+iZmNs9vrb Xep3RpHz08njpONSAlsoTON3r4bcmX9Rw=; b=fFmsJ718ZQx+lkHffBCHkUef9E kadeTH80rrICBZXmX8qZICW8h5FE621sxUzlPC4eEdP9q/IWkSDifxCaKt18styw 6R/ATz+TZlCwwDEdm/pnXpSvxbXx8kNqaKETujGEHLqc7U+ZEtFnr4g3fi7S05lQ wpE74rhbZ+glvOXd3AM4yIcQ10/UsV6YWEhUH38GTPmQFtjEnMYC8et4pSZqFhjb C7cXvSene+ThetHK50cNXjZeo0Mvu75Ug5C/r92LwqYOpDnelaMByUiXO7h4TQpu PKo42bkkKRvp+Nnq+q1Grjl/wRRboxGdXRYVk/GrkTp6ceImuDEOA4PyRR9w== 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= 1769489713; x=1769576113; bh=+iZmNs9vrbXep3RpHz08njpONSAlsoTON3r 4bcmX9Rw=; b=dwoMHRx8E1y5bzTMQOSVTwqMbt0MF0JfhkHsSY5WUxH/3uMiL5m CRqQFFAhYeP/0K8We/tcwnSnweW2VlisgygWmNtUaH3FECa8Feubr19N7o9+4pdq KhTGgBs0S4fGNLBEPPkeNS4XuCTLQ3CsP6bdHq4H0jF9nilaRqZiu0cwPD6CITJW 2ksCKwdelcCybKs1XnooQCr0hmKFTqk9Rxp7y+7sHR8mr8Oe2Nk90GtnEBSMtBov nKUNevTFWMjQZuvZlZDK1L3B42ZssMrLGhNcJHV33aMOmk3xkb3lQYgzQ1WenUr/ aQOKKaifL+y6WiEoohPxubRps7M3H8lr7vQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduheelieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheptghorh gvhidrhhhuihhnkhgvrhesghhmrghilhdrtghomhdprhgtphhtthhopehlihdrvghvrghn rdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehtnhgurhifrghnghesghhmrg hilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhp ohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Jan 2026 23:55:11 -0500 (EST) Date: Tue, 27 Jan 2026 13:55:06 +0900 From: Michael Paquier To: Corey Huinker Cc: Chao Li , 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="TO71gxnkcQCasJIs" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TO71gxnkcQCasJIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 26, 2026 at 04:42:38PM +0900, Michael Paquier wrote: > Another side note: I am not sure how the CI or the buldfarm did not > notice that, but I've found a bug in the tuple initialization logic > while reviewing more the code, fixed in 114e84c532d1. Perhaps my > build environment was more efficient in detecting that. So, I have done more work on all that, and extracted two more pieces, applying them: - The bits for dependencies in the restore function, . - The pg_dump bits for dependencies and n_distinct, as of c32fb29e979d. It was sad here that your posted patch did not use the keys of statistics_format.h. A comment was also missing in AdjustUpgrade.pm, where the code will be able to handle the "version" tag included in the dumps. Another thing that I strongly suspect is going to break in the buildfarm are the cross-version upgrades, because the format of the pg_dependencies and pg_ndistinct is not completely portable. While dumping the data for versions older than v18, there are a couple spaces added due to the way the JSON data is translated. A similar issue unfortunately exists for the rounding of the degree numbers in dependencies. I am not sure if this is going to break, but if this breaks I have prepared the following insurance policy for AdjustUpgrade.pm: $dump =~ s {\n(\s+'n_distinct',) '.*'::pg_ndistinct} {\n$1 'EXT_STATS_DATA'::pg_ndistinct}mg; $dump =~ s {\n(\s+'dependencies',) '.*'::pg_dependencies} {\n$1 'EXT_STATS_DATA'::pg_dependencies}mg; This is a filter similar to the "version" field, except that we would replace all the contents of the pg_ndistinct and pg_dependencies values inside single quotes, protecting the dump comparisons for the new and old versions. Let's see first what the buildfarm says and if I need to pull this switch. And it means that at this point we are feature-complete for these two stats kinds, so there will be at least something for this release even if MCV and expressions don't make it. Still, the other pieces should be slightly easier to integrate now that the core parts have been added. -- Michael --TO71gxnkcQCasJIs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAml4RSoACgkQnvQgOdby QH1TrhAAo7htOw2kZ8B2pCJg7vYGTWgFq/Dx8MAZb3GP7IaLuADxIk1eipXNq1Nt oncMiQIVgOiuDwGVaM3X5t1Jv7DQEaENr9CCZwioZGIn8G/EHNEQa3H1DFnPq/sY JZkWhrI+D1I4rhbHPT8+Gp1hwAugeCUkWWqK3ZC/okntQloQ0ckbZlYtwd7D1fR7 iW48YpiSq8dFb8E9TIfP2QPuOwW4CO2tsIJDiT/3Wq1gGtOWK5IwJ6KHz3fBBp/p DHA4VMl0U/S+GfaH68jBTxg9FNFz523EeT5K+iFb+3aQO+fnbAduoUurVtAkI6uI DKnZIYyPhPT2YiBL+gFw5fz33j9nOF/9wg4Ls0Mnz0PIODkEVEv3u841Ymci6+jc R4vECESYqC7XcoP6Z+In2Qi3Mh+7JvrmTOKC6eVAwlUBWHTfkKBjgLcXVe5nCohX wtdVeldyEDON3FAyWI+WlvMV4uHZKqDuyCQ+7J06uVOD2jtNvAtmCBEcgVLOpPzy Jpuqnk7uOY+pnulh4aAkeyyXToCn75TqcyTahr1LxxQvMdEqkdGoSi11NqeG1Ozi X3/NE3h9RbgO+KlRX43ro1nF6kaQepHoJ6+OZU4vEX+vSztSW0/qLaedKoz4bsXP oOLbgEtCH8UqRh03JXMFh0IoeK2Lk3WE/KefnQGkkEHY2hdWIig= =0XLh -----END PGP SIGNATURE----- --TO71gxnkcQCasJIs--