correct the sizes of values and nulls arrays in pg_control_checkpoint
Hi,
pg_control_checkpoint emits 18 columns whereas the values and nulls
arrays are defined to be of size 19. Although it's not critical,
attaching a tiny patch to fix this.
diff --git a/src/backend/utils/misc/pg_controldata.c
b/src/backend/utils/misc/pg_controldata.c
index 209a20a882..b1db9a8d07 100644
--- a/src/backend/utils/misc/pg_controldata.c
+++ b/src/backend/utils/misc/pg_controldata.c
@@ -79,8 +79,8 @@ pg_control_system(PG_FUNCTION_ARGS)
Datum
pg_control_checkpoint(PG_FUNCTION_ARGS)
{
- Datum values[19];
- bool nulls[19];
+ Datum values[18];
+ bool nulls[18];
TupleDesc tupdesc;
HeapTuple htup;
ControlFileData *ControlFile;
Regards,
Bharath Rupireddy.
Attachments:
v1-0001-correct-the-sizes-of-values-and-nulls-arrays-in-p.patchapplication/octet-stream; name=v1-0001-correct-the-sizes-of-values-and-nulls-arrays-in-p.patchDownload
From 52675dfadb6909d612a39dc0f9732687626dbd77 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Thu, 23 Dec 2021 11:38:15 +0000
Subject: [PATCH v1] correct the sizes of values and nulls arrays in
pg_control_checkpoint
---
src/backend/utils/misc/pg_controldata.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c
index 209a20a882..b1db9a8d07 100644
--- a/src/backend/utils/misc/pg_controldata.c
+++ b/src/backend/utils/misc/pg_controldata.c
@@ -79,8 +79,8 @@ pg_control_system(PG_FUNCTION_ARGS)
Datum
pg_control_checkpoint(PG_FUNCTION_ARGS)
{
- Datum values[19];
- bool nulls[19];
+ Datum values[18];
+ bool nulls[18];
TupleDesc tupdesc;
HeapTuple htup;
ControlFileData *ControlFile;
--
2.25.1
On Thu, Dec 23, 2021, at 8:39 AM, Bharath Rupireddy wrote:
pg_control_checkpoint emits 18 columns whereas the values and nulls
arrays are defined to be of size 19. Although it's not critical,
attaching a tiny patch to fix this.
Good catch! I'm wondering if a constant wouldn't be useful for such case.
--
Euler Taveira
EDB https://www.enterprisedb.com/
On Thu, Dec 23, 2021 at 9:13 PM Euler Taveira <euler@eulerto.com> wrote:
On Thu, Dec 23, 2021, at 8:39 AM, Bharath Rupireddy wrote:
pg_control_checkpoint emits 18 columns whereas the values and nulls
arrays are defined to be of size 19. Although it's not critical,
attaching a tiny patch to fix this.Good catch! I'm wondering if a constant wouldn't be useful for such case.
Thanks. I thought of having a macro, but it creates a lot of diff with
the previous versions as we have to change for other pg_control_XXX
functions.
Regards,
Bharath Rupireddy.
On Thu, Dec 23, 2021 at 9:16 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
On Thu, Dec 23, 2021 at 9:13 PM Euler Taveira <euler@eulerto.com> wrote:
On Thu, Dec 23, 2021, at 8:39 AM, Bharath Rupireddy wrote:
pg_control_checkpoint emits 18 columns whereas the values and nulls
arrays are defined to be of size 19. Although it's not critical,
attaching a tiny patch to fix this.Good catch! I'm wondering if a constant wouldn't be useful for such case.
Thanks. I thought of having a macro, but it creates a lot of diff with
the previous versions as we have to change for other pg_control_XXX
functions.
I've added a CF entry to not lose track -
https://commitfest.postgresql.org/36/3475/
Regards,
Bharath Rupireddy.
On Thu, Dec 23, 2021 at 05:09:28PM +0530, Bharath Rupireddy wrote:
Hi,
pg_control_checkpoint emits 18 columns whereas the values and nulls
arrays are defined to be of size 19. Although it's not critical,
attaching a tiny patch to fix this.
LGTM
It's helpful to check the history to find where the error was introduced:
4b0d28de06b28e57c540fca458e4853854fbeaf8
2ede45c3a49e484edfa143850d55eb32dba296de
Show quoted text
diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index 209a20a882..b1db9a8d07 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -79,8 +79,8 @@ pg_control_system(PG_FUNCTION_ARGS) Datum pg_control_checkpoint(PG_FUNCTION_ARGS) { - Datum values[19]; - bool nulls[19]; + Datum values[18]; + bool nulls[18]; TupleDesc tupdesc; HeapTuple htup; ControlFileData *ControlFile;
On Thu, Dec 23, 2021 at 09:16:02PM +0530, Bharath Rupireddy wrote:
Thanks. I thought of having a macro, but it creates a lot of diff with
the previous versions as we have to change for other pg_control_XXX
functions.
Yeah, I was wondering about that, but that's not worth the potential
conflict noise with the back-branches. Hence, fixed as suggested
first upthread. Thanks!
--
Michael