Re: shadow variables - pg15 edition - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: shadow variables - pg15 edition
Date
Msg-id 20221004023012.GT7745@telsasoft.com
Whole thread Raw
In response to Re: shadow variables - pg15 edition  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: shadow variables - pg15 edition  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On Tue, Oct 04, 2022 at 02:27:09PM +1300, David Rowley wrote:
> On Tue, 30 Aug 2022 at 17:44, Justin Pryzby <pryzby@telsasoft.com> wrote:
> > Would you check if any of these changes are good enough ?
> 
> I looked through v5.txt and modified it so that the fix for the shadow
> warnings are more aligned to the spreadsheet I created.

Thanks

> diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
> index 350039cc86..7848deeea9 100644
> --- a/src/backend/utils/adt/datetime.c
> +++ b/src/backend/utils/adt/datetime.c
> @@ -1019,17 +1019,17 @@ DecodeDateTime(char **field, int *ftype, int nf,
>                  if (ptype == DTK_JULIAN)
>                  {
>                      char       *cp;
> -                    int            val;
> +                    int            jday;
>  
>                      if (tzp == NULL)
>                          return DTERR_BAD_FORMAT;
>  
>                      errno = 0;
> -                    val = strtoint(field[i], &cp, 10);
> +                    jday = strtoint(field[i], &cp, 10);
>                      if (errno == ERANGE || val < 0)
>                          return DTERR_FIELD_OVERFLOW;

Here, you forgot to change "val < 0".

I tried to see how to make that fail (differently) but can't see yet how
pass a negative julian date..

-- 
Justin



pgsql-hackers by date:

Previous
From: "kuroda.hayato@fujitsu.com"
Date:
Subject: RE: [Proposal] Add foreign-server health checks infrastructure
Next
From: Peter Geoghegan
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early