Re: Fix inappropriate uses of atol()

2024-08-09 Thread Peter Eisentraut
On 03.08.24 16:07, Heikki Linnakangas wrote: On 03/08/2024 14:04, Peter Eisentraut wrote: I noticed (during [0]) to some uses of the function atol() seem inappropriate.  Either they assume that sizeof(long)==8 and so might truncate data if not, or they are gratuitous because the surrounding co

Re: Fix inappropriate uses of atol()

2024-08-03 Thread Tom Lane
Heikki Linnakangas writes: > I'm actually not even sure if it's intentional to throw the error even > with "char[1]". It makes sense to give an error on "char", but who says > that "char[1]" isn't a valid string? I agree that that behavior looks more like an implementation artifact than anythin

Re: Fix inappropriate uses of atol()

2024-08-03 Thread Heikki Linnakangas
On 03/08/2024 18:20, Tom Lane wrote: Heikki Linnakangas writes: On 03/08/2024 14:04, Peter Eisentraut wrote: I noticed (during [0]) to some uses of the function atol() seem inappropriate. +1 except for this one: /* If we have just one character this is not a string */ -

Re: Fix inappropriate uses of atol()

2024-08-03 Thread Tom Lane
Heikki Linnakangas writes: > On 03/08/2024 14:04, Peter Eisentraut wrote: >> I noticed (during [0]) to some uses of the function atol() seem >> inappropriate. > +1 except for this one: >> /* If we have just one character this is not a string */ >> -if (atol(p->type->size) ==

Re: Fix inappropriate uses of atol()

2024-08-03 Thread Heikki Linnakangas
On 03/08/2024 14:04, Peter Eisentraut wrote: I noticed (during [0]) to some uses of the function atol() seem inappropriate.  Either they assume that sizeof(long)==8 and so might truncate data if not, or they are gratuitous because the surrounding code does not use the long type.  This patch fix