Replace magic constants used in pg_stat_get_replication_slot().
authorAmit Kapila <[email protected]>
Wed, 30 Jun 2021 05:59:53 +0000 (11:29 +0530)
committerAmit Kapila <[email protected]>
Wed, 30 Jun 2021 05:59:53 +0000 (11:29 +0530)
A few variables have been using 10 as a magic constant while
PG_STAT_GET_REPLICATION_SLOT_COLS can be used instead.

Author: Masahiko Sawada
Reviewed-By: Amit Kapila
Backpatch-through: 14, where it was introduced
Discussion: https://postgr.es/m/CAD21AoBvqODDfmD17DkEuPCvV2KbruukXQ2Vwrv5Xi-TsAsTJA@mail.gmail.com

src/backend/utils/adt/pgstatfuncs.c

index 14056f53471d365f9065eb94a93f284214fad346..f0e09eae4d66267e2be75417dc64186067dd91cc 100644 (file)
@@ -2317,8 +2317,8 @@ pg_stat_get_replication_slot(PG_FUNCTION_ARGS)
    text       *slotname_text = PG_GETARG_TEXT_P(0);
    NameData    slotname;
    TupleDesc   tupdesc;
-   Datum       values[10];
-   bool        nulls[10];
+   Datum       values[PG_STAT_GET_REPLICATION_SLOT_COLS];
+   bool        nulls[PG_STAT_GET_REPLICATION_SLOT_COLS];
    PgStat_StatReplSlotEntry *slotent;
    PgStat_StatReplSlotEntry allzero;