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 1wC4yh-001dx7-1T for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2026 00:16: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 1wC4yf-003Zgd-2l for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2026 00:16:34 +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 1wC4yf-003ZgT-1q for pgsql-hackers@lists.postgresql.org; Mon, 13 Apr 2026 00:16:34 +0000 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wC4ye-00000000iAi-1llK for pgsql-hackers@postgresql.org; Mon, 13 Apr 2026 00:16:33 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.stl.internal (Postfix) with ESMTP id 3D3417A0032; Sun, 12 Apr 2026 20:16:32 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-02.internal (MEProxy); Sun, 12 Apr 2026 20:16:32 -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=fm2; t=1776039392; x=1776125792; bh=RWBNUAdBCP l/ZI+LdIFWS0Nve7H6/gn8kg9IiTOtSL8=; b=m/C2984yQkKdjgv3hXnn7/eXgQ GkTNnUE7muN/tssf5FOKUzy/8g1Ay5x0C4740zIZn2FxGsY0GNALuUq/JxUE9B/9 +xA3CZaEL9pLxszuX32KdKI4u76kMS3YsimF2qLnfuirK7nxqEdc8Iopgp/UI8ge Acu/+lFkb/cKAh2RmAts2u5Mg/0rMpmGyfkZD+P2vcVZDWtwCR4xqnJ8fibB5/7l 7a85WU43EbpJJyHIqQz6mtoBhBbpTE8gQM+zwQ7yW8L4cz+Eec5FVGuHmp09sJIx PX1Hi3qljsUCZhZMcFTxXRnkzlWXwOL7H3tO14JlZpGEsgsOVguWL17ahJQQ== 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= 1776039392; x=1776125792; bh=RWBNUAdBCPl/ZI+LdIFWS0Nve7H6/gn8kg9 IiTOtSL8=; b=E0eq+IaLDiUd6LHmK411bVwXW0BbvueiCmeqcF+rlb1nxjasTYc iBW/wcrFO8bXnfTIrWvlGaaN22aHEXKGQ9L6WUQ5YUy3v7WHrtMTRgDfVIWN3zsS HFlRUPjspo+RL8Xkxp6zYy5lmCWQSVu397onT21UrI+adT6yxg2QLpAC1YCJgRsV 1XWkGsyfGvyX3Hosvn7ZwtzHD64ztJcGRuKkR16X0rCEQsp4klB7snchvmwz1KlZ mhF+/KPV1d/a3Y+kmDb0Pa8SeWkuTY52urFA2rDfu1ggsvrFOm0AaGjhq1zdk5Bh OnBi1YzTQM7KeKcFyCGq9GL1A8HG2PMDciw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdefieejgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlh cuvffnffculdejtddmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvden ucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquh hivghrrdighiiiqeenucggtffrrghtthgvrhhnpeetleeifedufffhhfdtteelgeeggeff hfekueevteeigfduudevudetgfegiedvjeenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiipdhn sggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeifrghngh guphdvtdduledutddtkeesghhmrghilhdrtghomhdprhgtphhtthhopehlihdrvghvrghn rdgthhgrohesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrh hssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 12 Apr 2026 20:16:30 -0400 (EDT) Date: Mon, 13 Apr 2026 09:16:29 +0900 From: Michael Paquier To: Dapeng Wang Cc: Chao Li , PostgreSQL-development Subject: Re: Fix pgstat_database.c to honor passed database OIDs Message-ID: References: <8CD3DF77-C4F0-4CA0-B329-2B62B5A85E3B@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Djy97qQmSHCU6yVj" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Djy97qQmSHCU6yVj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 10, 2026 at 09:01:32PM +0800, Dapeng Wang wrote: > Without the patch, calling > pg_stat_reset_single_table_counters('pg_shdescription'::regclass) > incorrectly updates the current database's stats_reset timestamp > while leaving the shared db entry (datid=3D0) unchanged. >=20 > With the patch, the shared db entry's stats_reset is correctly > updated, and the current database's timestamp is not affected. The coalesce() trick to bypass the fact that the reset timestamp may not be reset was a bit ugly, so I have used instead a second reset. I have limited the test to check for datid=3D0, not MyDatabaseId. There is a bit down in stats.sql an extra portion of the test where we use twice pg_stats_reset(). One reset could be removed, but I have left it as-is in case someone decides to shuffle or split things in this test script, to avoid problems in the future. And fixed that down to v15. -- Michael --Djy97qQmSHCU6yVj Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmncNd0ACgkQnvQgOdby QH21HxAAizlBLTi3RTjFQblDTjS0hyMdDN9cqz9mG7HaHKclF7RwXckefKPI/wqx XXdCKcvIs4PHbs5NSWlS6yASBoJfCQGH4DrTO2uy8Aw9+QlyQlVpNv+02aRBu8ZU DhlBmHnGEn3WZq4jE08dC2a0F8Ww9AUBJ2bpY4tYHaCZeWS4G+DurlECegb8j0ar 3d38duXEDmTluxoHpAGCJhDlBMC300l24xXbSRYB4Z9tctTMnKU3fFbPMY9UFlc+ SCG4e412c0dbxdUScCqjA0r6X0/pff9A641tRmldB0ocpnPTfp9a16p89EUfbt/w UduSMS4qHNX/QGvA4Yf+tGBmeopPXC0QRAhkis3KIZdpQpXk24WIfJK8WvSnpQI3 m2YqS28xCNrFI5xjpwRIvJgJhjZFlFUlfPX2r0Za/i/SEAqL4brKl0/vR2Qqzp5S oFBsphVjcy4RDFwF2vVdaGBX3eRnSVcX49ki0ya86ONX4DmhENeGQP3l+U+WkKum 6PfnOSZuU8+5Vujfg6kpcd1hn7Z1q0lyUwM4xCONw+IpXPFvoMjxFLpJ7VRTOOnz cxxojIpdQ9D+KEwMXQTWzt8W/i9Ha2auPT5ineFNi1vclVVDdUj7JsDXycVMCjOa z9ZgbCq76YIFFwxgDdGqYuMyRYeBpRl9TphoMfchLMOmjIIoAqs= =K329 -----END PGP SIGNATURE----- --Djy97qQmSHCU6yVj--