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 1weN0C-004lCk-2A for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2026 01:11:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1weN0A-005c9I-0p for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jun 2026 01:11:02 +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 1weN09-005c94-30 for pgsql-hackers@lists.postgresql.org; Tue, 30 Jun 2026 01:11:01 +0000 Received: from mail-dl1-x1230.google.com ([2607:f8b0:4864:20::1230]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1weN07-00000000tRc-1PhE for pgsql-hackers@postgresql.org; Tue, 30 Jun 2026 01:11:01 +0000 Received: by mail-dl1-x1230.google.com with SMTP id a92af1059eb24-139b914bab6so5387482c88.1 for ; Mon, 29 Jun 2026 18:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782781857; cv=none; d=google.com; s=arc-20260327; b=nnlmKxRVxS01wQppYgberkEjCfO4mtExbzmQEDmw2h/u0gI4PrakZMzNiVgob9p/9J C8KHMU9Qn8ACABTN0VKJRFijowAOvwbWIPf/BZDWBS1Z3/z0xqWqrYvjP+XiWQk+CZF9 wFyB+eaaZ9iw5Rm8ceNwFxOcb/7CE15u7en2w1xYuMiHSAqEznAPfSrBRnA4+upJw1cc ubwh3e3ybAQYchSqM2pEOehareWEa1ayOPBmcMis6je+WT5F15cJS0nzvDJSr24IM8M1 gY6TGkD6CSDMe7qbb95DSQevb2xgAFNNtTd+YB/MwfMvo2uS13jkIubT97gwBudry/4b t/IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=n2qJrJ81uDdAhqshMh/A0+ozyAvf/rmX14qOC/HrG9Q=; fh=BOjmScMzAZvdCKXqwZCCTUocKYX0GlGEWbD+M7xZQmE=; b=dBnHS3NjHJg/ymvEM9BmT2lNeh9+u7MDiYSPulrdUFSR6MEPKAFq33iDb1Gf2y86wU xNVcS0cd5OMvQa1BSLUIdZyrzXm8uJyYlza+g+aAA4XfROZKkvHg+qx7qeP6vm/7Ea/Q G6M/a0R+KpirTJVvIPH7eAr2vB8IGB+DMTIfojmAOWaWstZP/bbzqApZ2WYCFtmz2jKW vo1NgyuYsJv7Ti2jslCIjdv6vCRt9ZLkbUviXrn9u1tBPIl6WViZw4mqmnjetAvwro2T 5M46joRERokNpO/I41EmrRdBjV9aBRUJaBniqbseTTGGrMi2vLLTWIh2VY76Ce2WOgJA o9Pw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782781857; x=1783386657; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=n2qJrJ81uDdAhqshMh/A0+ozyAvf/rmX14qOC/HrG9Q=; b=CU8Bdxga7hzUqwn0T5cY5IfSVvRt6/qcfCNPlYO3FkKnuu3qe494vZSAHp5XCAF18/ WN1tV6c5znQN/Ufkn7TI8Rzi2HP8uEchYIvEKQtlHi69HhO/vE8LCILi7QNiwme+o4w3 7R0UWpbtJ8WvEch31nRrdzVWqsfsNrHBJcl4XnLyWEG/bUMY8f7XvKwVWY8aC7zS6PnO Vkvs4lLLqGtktZlhRtiA5sOuXDe9cDrLBXeECCgG+hvWcsaVFXB6yllQ5S2VQY+YdlqW 5P9az63gUb5nXh2UTReevy6/UFp9yoFgn3XdN7VmUK/C9Jpz7SBX8kqYqFQ9ZmPU4Rnv g2Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782781857; x=1783386657; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=n2qJrJ81uDdAhqshMh/A0+ozyAvf/rmX14qOC/HrG9Q=; b=VPTjpzF/E84w0gs51tM9lPQm70L9riu1Uj2amA4CrSFGQM0wQ4MWOLjDDHS36Nm/mZ ipeRAL+qcFCAMPrMzNouCZdQgNaqIvXyFlo1PxarmfJIZB2l0pTEvy/mtdkm8h0xNoOD 3D8E5Gz3+XC1UybGUe10Ncrn4dYwFTMDDLg9LxAe6EdInbPvUQgk1IRvUdSo1KQ+10lu pq3nHt7xqBRXlF6pCsz0a+PQ74yCPku6KUJBnQTp528uQlB4qJ/WVf+JoYfgE7XtvAgK 6mv5UiANlIZ1WuW6F8ti8KlFEGLh4CWlIGL1CEiKclGieGlg+cTxLmhEASRqghBdEs5v HBfQ== X-Forwarded-Encrypted: i=1; AFNElJ9sX/HOaQn4cbnICp+Xd8Ox8dSKU/XtWjLC5STCmY0Tj/uCfcSmNzm2OJ1ZRLjbrnqHNHInIzzQ9IVE7RzE@postgresql.org X-Gm-Message-State: AOJu0Yz9bftMQ2XWG+MmV1gEAfrRfE1tSuvj9rD9EffeZjqgj0M4HlZj OtQwws08d7k7MA5QWt4pl7yyDL7SWb6pytbocAUH73CDDAMqGIOBejf8OgqGVS5g+CFlFI1CX54 EbQHTh9qXewaYFQUxghRqjP57T6TWJl2tArEW X-Gm-Gg: AfdE7cm4MSfiiOsMPOsWcGHff3Gr8O/xS+MSQxZtqxl02aBg8rirTLcUu7w9MCO6JGZ gkOM9g2anpAXy9Kdpdr03F4H1ox3WJN3gBmqJaqyBj8Tv3ALtxmCC+l7zL0N/fznfICDmeJAkCj P4yyjnQQSn8LqW60yFp7SPct1/pJfWJ73KIQ9+U4Z7xY+jqhb3tGx20CGiA/Ve/Uo6Gq1SPmI82 KgJzqWJbYep4qwk8J/a6I6/WvmPUE5JP9slW3rXvV+4mYcBZUKduPSZkZAdvSwW9EUbRJjDk8JQ G7ynj+jY51+aSYuA0v4DGWQip+MsuABOP0GuzJ7+KLslW0SmXm/VQ5Jc3Ap19dzxNytmWuZ1lFl FTwIwuhE8fiys1VSdQB2fl9xnh9fDN2MiTVEnlG2p/gc1/1e8 X-Received: by 2002:a05:7022:faa:b0:137:f001:fce2 with SMTP id a92af1059eb24-13b2a1bf0e5mr904172c88.33.1782781856615; Mon, 29 Jun 2026 18:10:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Corey Huinker Date: Mon, 29 Jun 2026 21:10:41 -0400 X-Gm-Features: AVVi8Cdy6oDKTOklkU4He2GAil7BNNlqXe1VjFSnWjUnvVnoqO_yZv96tsFynIc Message-ID: Subject: Re: use of SPI by postgresImportForeignStatistics To: Robert Haas Cc: Etsuro Fujita , "pgsql-hackers@postgresql.org" Content-Type: multipart/alternative; boundary="00000000000046913a06556e3fff" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000046913a06556e3fff Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 29, 2026 at 2:17=E2=80=AFPM Robert Haas = wrote: > On Mon, Jun 29, 2026 at 7:50=E2=80=AFAM Etsuro Fujita > wrote: > > I like this refactoring, but while it's rather mechanical, it's pretty > > large, so I think it's too late to do the refactoring at this time > > just before the beta 2 release. So I'd vote for going with your > > v1-0001 and v1-0002 and doing the refactoring in v20. As mentioned by > > Robert, I don't think it's good to call LOCAL_FCINFO() in > > import_relation_statistics() and import_attribute_statistics() to call > > the guts of those functions either, but that is *consistent* with the > > existing way pg_restore_relation_stats() and > > pg_restore_attribute_stats() do that, so that is actually not that > > bad. Also, as you mentioned above, it's inefficient for the new API > > functions to lock an already-locked relation, and validate an > > already-validated attname/attnum, but I think it would be negligible. > Fujita-san, is it then your plan to get those two patches committed? Are we ok with changing the functions that postgres_fdw makes from v19 to v20? Because what I put in the v2 patch does not match the v1 patch. If we are NOT ok with that, then we'd need to: 1. rename the two relation_stats_argnum -> relation_args_argnum and attribute_stats_argnum -> attribute_args_argnum out of the way of the ones created in relation_stats.h and attribute_stats.h. The actual enumeration values can stay the same, as there are no conflicts there, just ambiguity about which set of values they belong to. 2. rename the existing static functions relation_statistics_update -> update_relstats and attribute_statistics_update -> update_relstats to make way for the public functions of the same names. 3. Create new relation_statistics_update and attribute_statistics_update, with the isnull/values, and have those fcinfo-invoke the respective pg_restore functions just like v1 does. That would at least make the user API consistent in v19 vs v20. I'm on vacation this week, but time is short for beta2, so I'll make an exception to get the above into beta2. Let me know if you want me to write that up. --00000000000046913a06556e3fff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Jun 29, 2026 at 2:17=E2=80=AFPM R= obert Haas <robertmhaas@gmail.c= om> wrote:
On Mon, Jun 29, 2026 at 7:50= =E2=80=AFAM Etsuro Fujita <etsuro.fujita@gmail.com> wrote:
> I like this refactoring, but while it's rather mechanical, it'= s pretty
> large, so I think it's too late to do the refactoring at this time=
> just before the beta 2 release.=C2=A0 So I'd vote for going with y= our
> v1-0001 and v1-0002 and doing the refactoring in v20.=C2=A0 As mention= ed by
> Robert, I don't think it's good to call LOCAL_FCINFO() in
> import_relation_statistics() and import_attribute_statistics() to call=
> the guts of those functions either, but that is *consistent* with the<= br> > existing way pg_restore_relation_stats() and
> pg_restore_attribute_stats() do that, so that is actually not that
> bad.=C2=A0 Also, as you mentioned above, it's inefficient for the = new API
> functions to lock an already-locked relation, and validate an
> already-validated attname/attnum, but I think it would be negligible.<= /blockquote>

Fujita-san, is it then your plan to get those two patches committed?

Are we ok with changing the functions that postgr= es_fdw makes from v19 to v20? Because what I put in the v2 patch does not m= atch the v1 patch. If we are NOT ok with that, then we'd need to:
1. rename the two=C2=A0relation_stats_argnum -> relation_ar= gs_argnum and attribute_stats_argnum -> attribute_args_argnum out of the= way of the ones created in relation_stats.h and attribute_stats.h. The act= ual enumeration values can stay the same, as there are no conflicts there, = just ambiguity about which set of values they belong to.
2. renam= e the existing static functions relation_statistics_update -> update_rel= stats and attribute_statistics_update -> update_relstats to make way for= the public functions of the same names.
3. Create new relation_s= tatistics_update and attribute_statistics_update, with the isnull/values, a= nd have those fcinfo-invoke the respective pg_restore functions just like v= 1 does.

That would at least make the user API consistent = in v19 vs v20.

I'm on vacation this week, but = time is short for beta2, so I'll make an exception to get the above int= o beta2. Let me know if you want me to write that up.=C2=A0
--00000000000046913a06556e3fff--