agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: pgsql-hackers@postgresql.org, Tomas Vondra <tomas.vondra@postgresql.org>
Cc: Peter Smith <smithpb2250@gmail.com>
Subject: Re: shadow variables - pg15 edition
Date: Mon, 3 Oct 2022 21:30:12 -0500
Message-ID: <20221004023012.GT7745@telsasoft.com> (raw)
In-Reply-To: <CAApHDvq4dg7M+_imHZJ3bxNRW53EBkDuo6jxmSnMtrtX_Br3fQ@mail.gmail.com>
References: <20220819042816.GU26426@telsasoft.com>
	<CAApHDvrwLGBP+Yw9vriayyf=XR4uPWP5jr6cQhP9au_kaDUhbA@mail.gmail.com>
	<20220823011659.GF2342@telsasoft.com>
	<CAApHDvovE675zPvqiY6Y9pV1X53jSGjyhkf75yc8WGy7qAGdEA@mail.gmail.com>
	<20220823021412.GG2342@telsasoft.com>
	<CAApHDvoSgT93Da5D=ZWWhsE_exGyjK6sGWt5LpFJHsnaXVELzw@mail.gmail.com>
	<20220824023944.GM2342@telsasoft.com>
	<CAApHDvpL3ZpRhSaLf7wqSAbF42RtnJ_7puyiXR=2RdkoZ9RsjQ@mail.gmail.com>
	<20220830054441.GF31833@telsasoft.com>
	<CAApHDvq4dg7M+_imHZJ3bxNRW53EBkDuo6jxmSnMtrtX_Br3fQ@mail.gmail.com>

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





view thread (56+ messages)  latest in thread

Message-ID: <20221004023012.GT7745@telsasoft.com>
Permalink:  ../20221004023012.GT7745@telsasoft.com/
Also on:    postgresql.org/message-id/20221004023012.GT7745@telsasoft.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, dgrowleyml@gmail.com, tomas.vondra@postgresql.org, smithpb2250@gmail.com
  Subject: Re: shadow variables - pg15 edition
  In-Reply-To: <20221004023012.GT7745@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox