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 1x21Zz-005XvD-2q for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Sep 2026 07:09:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x21Zw-00GLiy-1a for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Sep 2026 07:09:44 +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 1x21Zv-00GLiq-1W for pgsql-hackers@lists.postgresql.org; Thu, 03 Sep 2026 07:09:44 +0000 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x21Zt-00000003lZj-1Dp2 for pgsql-hackers@postgresql.org; Thu, 03 Sep 2026 07:09:42 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id B856AEC018D; Thu, 3 Sep 2026 03:09:39 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Thu, 03 Sep 2026 03:09:39 -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=fm1; t=1788419379; x=1788505779; bh=+5oRJAwkou pX6l4kkRs1+jVD+UZmqEf2uhHt7pkA0+o=; b=sP1FdcriDB0x2n0TA1PaN7K99l P0t/0cozx7ztpVbQa34ksaSYE6Kt7wR7CesTaSgo9geGusyQZSOhqR1Uk64YHkEK 5eVam3lAscUyOyOb+QShMVeDMcyArdF8kLDrCBOpZnjyEYoSJadsoZ8lEd5x1SWN FS4bDFwFpI4vbVbevfh2uf6PcRS/VupluTp9PNNqpLvOzjpV7OxKZYtaLAAVpuPI 2QPf9VA0FksSqB7sL+Tjm0+W4oVAqQmMC0hUT/4sG5BOJ5c6Ak/lZE0T5iUXk0jj FGF14pPjw6Myi0+vbIkHCLwyjRdRmm3KXJAVEj90CDljy3G6VHS5iEIz7wwA== 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=fm1; t= 1788419379; x=1788505779; bh=+5oRJAwkoupX6l4kkRs1+jVD+UZmqEf2uhH t7pkA0+o=; b=O1TOho5acnUAYbHV+3crVGOwXezj/D08xoWyn7sSxcGmgHtiyly E99tFa65yJnkL7L2XxQwVrzm0Axs4/ZrhoEvzZpd4NqWdRvmW4AR8S3ZuXgfkAIM ngPwJfuvnaWxnMZu46F6CU/DXofJiIb8WfjvjRvN0EkxA2KaX9ceDLTiUlo/cRul xklaAyECZ5ymgkmtkzUgRaCmuOcaiPf7eM76N3xkh5xW1hjOgq+I8v6JZh//nC9S lFp8Cz1c3579i2kkqfwS5piTDDcf/lMDWn80X06JjSrGe7/uF2KFIZT1aKcGgQXO Yjsnx3SgW/o3HvHg+DQMDMGgDmVUnccGhqg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGNtrAKqA2wq9NQgKMi7txvMJO54mQz87c1mNq9+D58XIQ0lklU/sDXgr9iEhDorg m9d9w+rZ37F9isuVibIYOJFdyLnOkobCgpOlorjaxsnn/gI2zCQXUU0q6ewLOX6Sqbm+U9 VxliLVk7pPiWYC1lAgmKqD7CiTR7Z/e6eZudpOhNPJCeCoj6dm5sithJqW2TbtgIjmJ83a rbu9R8pB7IfWSClfDPHRAxkh1fA2GC4AXdUXmy+2c6qmxw2quNW0jVOX//aj4NJ0JngEFY wV7N+rxLY0ci1N5GTjhHupZUy06Tl+agfKuZMaws5VjxRmdk7uvO551jWfD+2mIxk7n0E3 6LNRg9MwWqL4pNgKbfAPIQPLrsW52fMJf1sPB+lymrHPtAdsiyA8QGnqhhMveZ4Wu+JZs/ u8a20vaKj4JNm9U0RLgGhXw0SL2ALzAn/UcmljG56xv/s86zPGwmZXTXBYUTIsNIeXTxtI aa/XCYanymX43KJRudBaTOSEbk1hrX9FRwl67v20Tffq3lxI02vHZrb7bfIJyLH9nKUHOg Rfmd+bdx+qiVQtNU5gdn6tdftwFhb5fJdhx3ntj2sSj+sivyWbs1zT1VRcmBYeq13bqJB6 Ov9gSptkmTACAhPT93e4oHIL4KqW1ncG9sXmkgUDTscHgrIvwvU0uagHclBw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 3 Sep 2026 03:09:38 -0400 (EDT) Date: Thu, 3 Sep 2026 16:09:34 +0900 From: Michael Paquier To: Etsuro Fujita Cc: Corey Huinker , pgsql-hackers@postgresql.org Subject: Re: Remove fcinfo from statistics update internal functions Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ieF+A1grAzvEimih" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --ieF+A1grAzvEimih Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 03, 2026 at 02:35:53PM +0900, Etsuro Fujita wrote: > How about setting those parameters as well, as we did before, because > we might use them in *_statistics_update_internal() in the future, as > I said upthread? IOW: I still don't think it's a good idea to > complicate the core code just for those parameters in the FDW case. I > think that that would just make the version diff large and > back-patching hard. Hmm. I'm not sure that this is correct with a v19 in mind. > I think that that is just an appearance problem; we could address it > by defining NullableDatums for each stats in import_fetched_function() > like: >=20 > NullableDatum version; > NullableDatum null_frac; > NullableDatum avg_width; > NullableDatum n_distinct; > ... Not sure that I that much. It does not address my concerns regarding the import APIs. > Also, I think it's important for import_*_statistics() to have > arguments like this that are consistent with the error messages in > stats-checking functions I mentioned upthread. Using the structures > doesn't match the messages, so that would degrade developer > experience. Ditto. >> Honestly, that's not a pattern I have seen a lot in the code base; we >> tend to use structure-based approaches to pass down data rather than a >> lot of args, because C makes this kind of code written easier to >> parse and less opaque by assigning values to each member of the >> structure. One example, the [auto]vacuum code for its state data and >> its options passed across various stacks. >=20 > That's true. However, having such a tendency is no reason to prohibit th= is. Disagreed. Consistency is usually good in code style. In terms of extension experience, the structures feel much easier to work with. That's less index positioning. >> What matters the most to me is the long-term maintenance of both code >> structures, and the more I think about it, the more the structures >> lead to a so-much-cleaner result. That would be even better with two >> initializer macros for each structure that extensions can just reuse >> to force isnull=3Dtrue for each element, though. This enforces a safer >> catalog insert policy for the import *and* the restore code. >=20 > I don't feel the need for such macros at least for the use of > import_*_statistics(), because those functions are only used by FDW > authors, and they reference postgres_fdw when developing their FDWs, > so I think it's enough to provide a safe use of those functions in > postgres_fdw (and the documentation for it) even without those macros. Even with my disagreements, it is pretty clear that you do not like these improvements, so I'll revert the refactoring piece. I am not planning to argue much for the FDW part (honestly I don't like the way this has been coded, and I regret not having spent a couple of cycles looking at what was happening, but I did not commit that). For the stats part, though, I am going to be on standby and more careful for any changes suggested.=20 Another part that I do not find acceptable is the "unused" arguments based on the StatsInfo. That's overlapping the import and restore bits, IMO. That part alone makes the 0001 proposed upthread a no-go here. -- Michael --ieF+A1grAzvEimih Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmqZHS4ACgkQnvQgOdby QH27vQ/8Cdg1kiPLHfgsEbngjRwekFSdYWO2KJXRrCfEgordPg9LMNfJvvip0VVa nuyAImhCg3zvLSzrJ4WtJy3qTyn3qLk0RCdsXVxQc3SyMWPOcHtQbBDeUSgWtsAe 7z0N+ub0Jq7lDWoGASmNvT9i4EjR0aJudgDVlj0SMswogkWcc28/hF7rAzi5LqAq leY23gbw3ZA0jdlAqp0DCszoEHplzV0MQHY/f7+JtFZTZ/MsliaGtNTzAWSeRBIl jJ5g8FSJNRVD72nHe1SkAuOx68bKJl/80jP7tqCYfIwJIt5187WWDr9IpWxeEKwR HV9sN8R+/xnoOpSjICl7MIv8JcZuYfRtq7weaBVstwqSOV+8C7F+qIfvdg4IGFbu AEfovpMWXbBCWZs0R7Tla39E6Y94JnLDx5KJDGJ5Q1nxazAPvdY82d5+I6piFGt0 s2XavsU/XxJGX4e6t34GHz68rtpVDLlY4x/PA0KW49kxgpk2nB1rbaZzH2P7E3JY ABCpE0WeYRaA124bZCwtQK+se55DPMK+uJF+m7G1ExX0yTjZyDesiTQ9jIAyTXBt dYg47Z+fhbBn6bxAZC57x/TFQBcIsjU0PVVIfz04mMRcZteUab1vLM4mgdsdpr0y BdmyfW21BPqmAH30r1CM6EcDwpxoEaDIILV9e/x+x3qFICVpAd8= =S+Re -----END PGP SIGNATURE----- --ieF+A1grAzvEimih--