The bugs team agreed that it's a bug. The documentation accurately represents the buggy code. I thought you might want to update the doc when the bug is fixed.


On 10/22/21 6:43 AM, Alvaro Herrera wrote:
On 2021-Jul-29, PG Doc comments form wrote:

https://www.postgresql.org/docs/13/datatype-numeric.html says that the range
of a numeric type integer is -2147483648 to +2147483647 but
PGTYPESnumeric_to_int considers -2147483648 (a perfectly valid 32-bit
integer) to be invalid because it compares to -INT_MAX instead of INT_MIN or
(-INT_MAX - 1). This goes back to the initial commit in the git repo for
src/interfaces/ecpg/pgtypeslib/numeric.c. And doc/src/sgml/ecpg.sgml
documents the min being -INT_MAX.
This sounds like an ECPG bug, not a documentation problem.