Re: shadow variables - pg15 edition
| От | Justin Pryzby |
|---|---|
| Тема | Re: shadow variables - pg15 edition |
| Дата | |
| Msg-id | 20221004023012.GT7745@telsasoft.com обсуждение исходный текст |
| Ответ на | Re: shadow variables - pg15 edition (David Rowley <dgrowleyml@gmail.com>) |
| Ответы |
Re: shadow variables - pg15 edition
|
| Список | 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 по дате отправления: