Re: shadow variables - pg15 edition

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Tomas Vondra <tomas(dot)vondra(at)postgresql(dot)org>, Peter Smith <smithpb2250(at)gmail(dot)com>
Subject: Re: shadow variables - pg15 edition
Date: 2022-10-04 02:30:12
Message-ID: 20221004023012.GT7745@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)telsasoft(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2022-10-04 03:11:20 Re: New strategies for freezing, advancing relfrozenxid early
Previous Message kuroda.hayato@fujitsu.com 2022-10-04 02:26:49 RE: [Proposal] Add foreign-server health checks infrastructure