Re: Operands don't affect result (CONSTANT_EXPRESSION_RESULT) (src/backend/utils/adt/jsonfuncs.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Operands don't affect result (CONSTANT_EXPRESSION_RESULT) (src/backend/utils/adt/jsonfuncs.c)
Date: 2021-02-11 13:08:09
Message-ID: CAEudQAqj=MK=G=uB8J0MV=8kCsLvbcGrKzSg=W3nGASsmLbG7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qui., 11 de fev. de 2021 às 01:46, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> escreveu:

> Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> writes:
> > *long* 4 *long int*, *signed long int* -2.147.483.648 a 2.147.483.647
> > Therefore long never be > INT_MAX at Windows 64 bits.
> > Thus lindex is always false in this expression:
> > if (errno != 0 || badp == c || *badp != '\0' || lindex > INT_MAX ||
> lindex
> > < INT_MIN)
>
> At the same time, I think this code could be improved; but the way
> to do that is to use strtoint(), rather than kluging the choice of
> datatype even further.
>
No matter the function used strtol or strtoint, push_path will remain
broken with Windows 64bits.
Or need to correct the expression.
Definitely using long is a bad idea.

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniil Zakhlystov 2021-02-11 13:09:20 Re: libpq compression
Previous Message Michael Paquier 2021-02-11 12:55:40 Re: ERROR: invalid spinlock number: 0