pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markos Fountoulakis <markos@planetscale.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: [PATCH] Fix argument in pg_indexam_progress_phasename()
Date: Wed, 21 Oct 2026 17:15:56 +0300
Message-ID: <e791bbb7-af3a-4a91-a5bb-c744e5c3ef54@planetscale.com> (raw)

Hello,

There is a oversight in pg_indexam_progress_phasename() since ab0dfc961b6 where the second argument is declared int8 in pg_proc.dat but gotten via PG_GETARG_INT32() in the C code.

This isn't much of a problem since 2a600a93c7b where Datums became 8 byte wide everywhere. However, this is an actual problem in 32-bit architecture in older PostgreSQL versions where int8 is passed by reference and returns bogus numbers. The side effect is that pg_stat_progress_create_index never shows the access method phasename. This should probably be backpatched.

-- 
Markos Fountoulakis
PlanetScale Postgres Core Team

Attachments:

v1-0001-Fix-argument-in-pg_indexam_progress_phasename.patch (text/plain, 956B) download From b231dd3982c4d59d37ad502db90a7ddb590fe828 Mon Sep 17 00:00:00 2001 From: Markos Fountoulakis <markos@planetscale.com> Date: Wed, 21 Oct 2026 16:37:04 +0300 Subject: [PATCH v1] Fix argument in pg_indexam_progress_phasename() The function is declared in pg_proc.dat as taking (oid, int8), but the C code fetched the second argument with PG_GETARG_INT32(). Use PG_GETARG_INT64() to match the declared signature. --- src/backend/utils/adt/amutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/amutils.c b/src/backend/utils/adt/amutils.c index 9e758ebaa6f..b9cfb7e6687 100644 --- a/src/backend/utils/adt/amutils.c +++ b/src/backend/utils/adt/amutils.c @@ -449,7 +449,7 @@ Datum pg_indexam_progress_phasename(PG_FUNCTION_ARGS) { Oid amoid = PG_GETARG_OID(0); - int32 phasenum = PG_GETARG_INT32(1); + int64 phasenum = PG_GETARG_INT64(1); const IndexAmRoutine *routine; char *name; -- 2.53.0

view thread (3+ messages)  latest in thread

Message-ID: <e791bbb7-af3a-4a91-a5bb-c744e5c3ef54@planetscale.com>
Permalink:  ../e791bbb7-af3a-4a91-a5bb-c744e5c3ef54@planetscale.com/
Also on:    postgresql.org/message-id/e791bbb7-af3a-4a91-a5bb-c744e5c3ef54@planetscale.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: markos@planetscale.com
  Subject: Re: [PATCH] Fix argument in pg_indexam_progress_phasename()
  In-Reply-To: <e791bbb7-af3a-4a91-a5bb-c744e5c3ef54@planetscale.com>
  References: <e791bbb7-af3a-4a91-a5bb-c744e5c3ef54@planetscale.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox