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

Fix inappropriate uses of atol()

2024-08-03 Thread Peter Eisentraut
https://www.postgresql.org/message-id/flat/5d216d1c-91f6-4cbe-95e2-b4cbd9305...@ewie.nameFrom 5b3908bffd5f2731550c810dadb50e7d40f1b855 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 3 Aug 2024 12:29:50 +0200 Subject: [PATCH] Fix inappropriate uses of atol() Some code using atol() would not