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 1wOpRk-000D8L-1k for pgsql-hackers@arkaria.postgresql.org; Mon, 18 May 2026 04:19:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wOpRi-0016M0-1K for pgsql-hackers@arkaria.postgresql.org; Mon, 18 May 2026 04:19:15 +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 1wOpRh-0016Lr-2B for pgsql-hackers@lists.postgresql.org; Mon, 18 May 2026 04:19:15 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wOpRf-000000007ua-2bk5 for pgsql-hackers@postgresql.org; Mon, 18 May 2026 04:19:14 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 876357A00CB; Mon, 18 May 2026 00:19:08 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Mon, 18 May 2026 00:19:08 -0400 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=fm3; t=1779077948; x=1779164348; bh=I6019T+E9M M5ITL0Jy9pvJ1HWf3JgG6URJFjyis98lM=; b=s+yesBEbOOTBE3BnceRm6mq6Lq GsPFMgi8cn+ndCFGjQKQGI1oIiFFMQG3d3JI6pF93r9idEFODM2P1/LggfyBCFcc Oa9LGUrU8opqjt8wyFcNQ3T2CAk8DMyZPcKUqufOgxiq24qFi4yEMwkrj71R2rQj NNKprYRVNRdRwcdov4ODL3kEf8pZClWkm4zLiQhJ1n2qFzFhO5yGIRTrc3Ktg4PA b2smT8Q0Hfl/F+gxdrax3TBTpdrCWLRa3tG9YcaVrHrSVYvjhocWW1DKtUf6SuUI 5XMxzghrV8fO7cM54yqvt0NZ2nvpODopk9Ex5EognaUGxdCMAWhwwEoxyn4g== 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=fm3; t= 1779077948; x=1779164348; bh=I6019T+E9MM5ITL0Jy9pvJ1HWf3JgG6URJF jyis98lM=; b=gAb+zd1AWjJQcTLEONlgp0AfZzI3Qlydlnn7oLOkX+IzmRUqr2k Mrp8htZcj1whJjJduqJoroFe6PBZ88Csj9AVE0bAd+vggJlxiqRWap8/pNXoc/Xf imSR1gePMzoIjZrKZegrGlVMxdj0voq90dX40hzxeTMBUMy3hDKXSuR2kJavYxWC IgYglzAd5k3vDWy2JQjhc3+b5rqDdFMZ717Yijqp9z4gqZBPhGdQOVZGRHpbRUBT Snb8S92MeCWUW35qnTE8YfuNbPwIGMsP9iCZdUHUrO5cHbcC3b3R11fxHfGtJJYD Mwo2L1IeTAioFBRMqjWYtKjMdI1fQkSWOcw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddufeejkeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttdej necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepveetjefgjeevgedukeehieeuieeu ieevueeiudegheevuefggfduueelgeelieetnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheplhhird gvvhgrnhdrtghhrghosehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgr tghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepmhhitghhrggvlh drphgrqhhuihgvrhesghhmrghilhdrtghomhdprhgtphhtthhopegtohhrvgihrdhhuhhi nhhkvghrsehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 May 2026 00:19:06 -0400 (EDT) Date: Mon, 18 May 2026 13:19:02 +0900 From: Michael Paquier To: Chao Li Cc: PostgreSQL-development , Michael Paquier , Corey Huinker Subject: Re: Fix small issues of pg_restore_extended_stats() Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="d5c8Yikloi3XRsMn" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --d5c8Yikloi3XRsMn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 18, 2026 at 10:25:16AM +0800, Chao Li wrote: > 1. Inconsistent expression key verification behavior >=20 > This function is actually doing a prefix comparison using the input > key length, so as long as an input key matches a prefix of a valid > key name, the function returns true. >=20 > At runtime, it does not lead to an incorrect value being imported, > because the invalid key will still be filtered out later. But one > bad scenario I can imagine is that a user is trying to set > =E2=80=9Ccorrelation=E2=80=9D, and accidentally omits the last =E2=80=9Cn= =E2=80=9D. In that case, > the key is silently discarded and the user is not aware of it, which > can lead to a surprising result. It's a silent data loss, with data getting ignored. The call should report a failure because the key does not match with a name we'd expect. pg_dump would not generate that, but stats injection is a supported use-case so that would be confusing. Nice investigation. =20 > 2. Wrong number in a warning message >=20 > The warning message says =E2=80=9C3 required=E2=80=9D, but it should be = =E2=80=9C1 > required=E2=80=9D. Harmless, still wrong. > 3. Inconsistent heap_freetuple() >=20 > In pg_clear_extended_stats(), heap_freetuple(tup) is only called > before the final return. However, in two earlier paths, the function > only emits warning messages and returns. It seems those paths should > also call heap_freetuple(tup). In the !IsValid() case, there is nothing to free, but you are right about the second case where stxrelid does not match. It's minor, but I don't have an argument against doing that either, and the free at the bottom is a trace that we want to be consistent. I'll go fix all that. Thanks for the report! -- Michael --d5c8Yikloi3XRsMn Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmoKkzYACgkQnvQgOdby QH2DCw//UPz9sQ6Pq8xvFaAE3eejarGIRXYFtCCw0HcLoUANWaB+Hc5LsyvB3fLV optbn7dTLHCC9BvsI5Zcs/l9QUf5BPX4Q9yFHQmkp85jB2B7tXICnxEmTHSzH7Zp TKU98HE6VcrCD/UaNiTpErbzFnTQQFLtCbGsRI2UkM+/P0Xpt2E0y15+zHtt9a/J h/umSf4k/CTwFXju66T7Jgf3zXFj3MkBCiSl0IDAIWieLLHUdU5XY4q7iXd+E1Eo z1XWZAENCWQOZQobgzw22mCXmJJ3zvMXRLFRAm1nOionMSMx+xSU3s2d9OsZfTNl ElBXQmMajofYEelcmF223zhIRMjDbEKpntSrx2E1x9hakutFqkC6sM4P2MKdjqu1 LtNn0FZeO5/2MSckLrUEm0AQZ8FXYr/zAFSUMzhHs8AzFgWUFyGQ8WpG6UImrF4N 3uEGdoty1UoNpxCxe0pTW/Ac4N2MHSpqnUAL31EGSFUj4bUbyv4CUHi5qJ3xM0jN kh0LVx4DamI9+CNt84Py2KnsnYPonfhKwb8Si/EG8ovOr49HjiyLIH/kkKmWb7Pf 4UJ3Jez6nbUI0nOOfs08QiVlLbN8VHa+DIbUYIJF4yMldrZBNbZJeMbozi47sjJF 0Y8brAl9YWSqWXf+M+5qiC0f32Ki5toTLodByAvy2Ki9NesDh/Y= =zR/l -----END PGP SIGNATURE----- --d5c8Yikloi3XRsMn--