Use PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()

Started by Masahiko Sawadaover 4 years ago4 messages
#1Masahiko Sawada
sawada.mshk@gmail.com
1 attachment(s)

Hi all,

I realized that we use the magic number 10 instead of
PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()
function. It seems an oversight of the original commit. Attached patch
fixes it.

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/

Attachments:

use_constant_value.patchapplication/octet-stream; name=use_constant_value.patchDownload
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 14056f5347..f0e09eae4d 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -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;
 
#2Amit Kapila
amit.kapila16@gmail.com
In reply to: Masahiko Sawada (#1)
Re: Use PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()

On Tue, Jun 29, 2021 at 5:12 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:

Hi all,

I realized that we use the magic number 10 instead of
PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()
function. It seems an oversight of the original commit. Attached patch
fixes it.

LGTM. I'll take care of it tomorrow.

--
With Regards,
Amit Kapila.

#3Amit Kapila
amit.kapila16@gmail.com
In reply to: Amit Kapila (#2)
Re: Use PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()

On Tue, Jun 29, 2021 at 6:07 PM Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Jun 29, 2021 at 5:12 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:

Hi all,

I realized that we use the magic number 10 instead of
PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()
function. It seems an oversight of the original commit. Attached patch
fixes it.

LGTM. I'll take care of it tomorrow.

Pushed.

--
With Regards,
Amit Kapila.

#4Masahiko Sawada
sawada.mshk@gmail.com
In reply to: Amit Kapila (#3)
Re: Use PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()

On Wed, Jun 30, 2021 at 5:12 PM Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Jun 29, 2021 at 6:07 PM Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Jun 29, 2021 at 5:12 PM Masahiko Sawada <sawada.mshk@gmail.com> wrote:

Hi all,

I realized that we use the magic number 10 instead of
PG_STAT_GET_REPLICATION_SLOT_COLS in pg_stat_get_replication_slot()
function. It seems an oversight of the original commit. Attached patch
fixes it.

LGTM. I'll take care of it tomorrow.

Pushed.

Thanks!

Regards,

--
Masahiko Sawada
EDB: https://www.enterprisedb.com/