Обсуждение: correct the sizes of values and nulls arrays in pg_control_checkpoint

Поиск
Список
Период
Сортировка

correct the sizes of values and nulls arrays in pg_control_checkpoint

От
Bharath Rupireddy
Дата:
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.

Вложения

Re: correct the sizes of values and nulls arrays in pg_control_checkpoint

От
"Euler Taveira"
Дата:
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

Re: correct the sizes of values and nulls arrays in pg_control_checkpoint

От
Bharath Rupireddy
Дата:
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.



Re: correct the sizes of values and nulls arrays in pg_control_checkpoint

От
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.



Re: correct the sizes of values and nulls arrays in pg_control_checkpoint

От
Justin Pryzby
Дата:
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

> 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;



Re: correct the sizes of values and nulls arrays in pg_control_checkpoint

От
Michael Paquier
Дата:
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

Вложения