Revise int2/int4/int8/float4/float8 input routines to allow for
Neil Conway <neilc@samurai.com>
Revise int2/int4/int8/float4/float8 input routines to allow for any amount of leading or trailing whitespace (where "whitespace" is defined by isspace()). This is for SQL conformance, as well as consistency with other numeric types (e.g. oid, numeric). Also refactor pg_atoi() to avoid looking at errno where not necessary, and add a bunch of regression tests for the input to these types.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/float.c | modified | +75 −46 |
| src/backend/utils/adt/int8.c | modified | +6 −3 |
| src/backend/utils/adt/numutils.c | modified | +19 −12 |
| src/backend/utils/adt/oid.c | modified | +15 −15 |
| src/test/regress/expected/float4.out | modified | +40 −3 |
| src/test/regress/expected/float8.out | modified | +49 −3 |
| src/test/regress/expected/int2.out | modified | +15 −5 |
| src/test/regress/expected/int4.out | modified | +17 −7 |
| src/test/regress/expected/int8.out | modified | +17 −2 |
| src/test/regress/expected/numeric.out | modified | +53 −0 |
| src/test/regress/expected/oid.out | modified | +34 −4 |
| src/test/regress/output/misc.source | modified | +2 −1 |
| src/test/regress/sql/float4.sql | modified | +18 −10 |
| src/test/regress/sql/float8.sql | modified | +24 −7 |
| src/test/regress/sql/int2.sql | modified | +10 −6 |
| src/test/regress/sql/int4.sql | modified | +12 −8 |
| src/test/regress/sql/int8.sql | modified | +11 −2 |
| src/test/regress/sql/numeric.sql | modified | +29 −0 |
| src/test/regress/sql/oid.sql | modified | +11 −4 |