Add explicit tests for division by zero to all user-accessible integer
Tom Lane <tgl@sss.pgh.pa.us>
Add explicit tests for division by zero to all user-accessible integer division and modulo functions, to avoid problems on OS X (which fails to trap 0 divide at all) and Windows (which traps it in some bizarre nonstandard fashion). Standardize on 'division by zero' as the one true spelling of this error message. Add regression tests as suggested by Neil Conway.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/cash.c | modified | +5 −5 |
| src/backend/utils/adt/char.c | modified | +4 −1 |
| src/backend/utils/adt/float.c | modified | +5 −5 |
| src/backend/utils/adt/geo_ops.c | modified | +2 −2 |
| src/backend/utils/adt/int8.c | modified | +13 −1 |
| src/backend/utils/adt/int.c | modified | +25 −1 |
| src/backend/utils/adt/numeric.c | modified | +2 −2 |
| src/backend/utils/adt/timestamp.c | modified | +2 −2 |
| src/test/regress/expected/errors.out | modified | +33 −8 |
| src/test/regress/expected/float4-exp-three-digits.out | modified | +1 −1 |
| src/test/regress/expected/float4.out | modified | +1 −1 |
| src/test/regress/expected/float8-exp-three-digits.out | modified | +1 −1 |
| src/test/regress/expected/float8-fp-exception.out | modified | +1 −1 |
| src/test/regress/expected/float8.out | modified | +1 −1 |
| src/test/regress/expected/float8-small-is-zero.out | modified | +1 −1 |
| src/test/regress/sql/errors.sql | modified | +33 −9 |