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
From b231dd3982c4d59d37ad502db90a7ddb590fe828 Mon Sep 17 00:00:00 2001 From: Markos Fountoulakis <[email protected]> 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
