Fix range check in ECPG numeric to int conversion
authorJohn Naylor
Fri, 30 Jul 2021 17:50:23 +0000 (13:50 -0400)
committerJohn Naylor
Fri, 30 Jul 2021 20:18:59 +0000 (16:18 -0400)
commit171bf1cea579ce11bc7f0b2986f052022f2b6be1
tree7e2c318bfaf975d675371ecff54b32798e217e54
parent41d27ee7b870c1a1213704d3c020a01eb55799b0
Fix range check in ECPG numeric to int conversion

The previous coding guarded against -INT_MAX instead of INT_MIN,
leading to -2147483648 being rejected as out of range.

Per bug #17128 from Kevin Sweet

Discussion: https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org
Reviewed-by: Tom Lane
Backpatch to all supported branches
doc/src/sgml/ecpg.sgml
src/interfaces/ecpg/pgtypeslib/numeric.c
src/interfaces/ecpg/test/expected/pgtypeslib-num_test.c
src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stderr
src/interfaces/ecpg/test/expected/pgtypeslib-num_test.stdout
src/interfaces/ecpg/test/pgtypeslib/num_test.pgc