contrib/intarray: always parse query_int integers as decimal. Previously we called strtol() with base 0, so that a leading zero digit caused the number to be read as octal. This is not documented because it was not the original intent: before commit 7ccb6dc2d, this code used atoi() which would have read the number as decimal always. Use base 10 instead to restore the original behavior.
Also reject a bare minus sign consistently. Per POSIX, strtol() "may" set errno for that case but doesn't have to, and if it doesn't then we'd not have noticed the bad syntax but read the value as 0. Although this change restores old behavior, 7ccb6dc2d was a long time ago, so it's at least possible that someone out there is expecting the octal behavior. So it doesn't seem like a great idea to put this into stable branches. But I (tgl) judge it not too late for v19. Author: Marko Grujic <[email protected]> Reviewed-by: Manu <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CAOvwyF3=brzoxwcwhrqqvljuqsqxitn7rxpkmnhxj1was5g...@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ccfe1db5a8a7c95f33c877a228af676b2e68e31d Modified Files -------------- contrib/intarray/_int_bool.c | 5 +++-- contrib/intarray/expected/_int.out | 10 ++++++++++ contrib/intarray/sql/_int.sql | 2 ++ 3 files changed, 15 insertions(+), 2 deletions(-)
