Tom Lane wrote:
> This isn't a division problem --- the difficulty is there's no check for
> overflow in int4 multiplication. (Nor in any of the other integer
> arithmetic operations, for that matter.)
It seems to me that SQL2003, Section 6.26 (<numeric value expression>,
"General Rules", item 5) requires that we check for overflow after
arithmetic operations on exact numeric types:
%%%%
5) If the most specific type of the result of an arithmetic operation is
exact numeric, then
Case:
a) If the operator is not division and the mathematical result of the
operation is not exactly representable with the precision and scale of
the result data type, then an exception condition is raised: data
exception numeric value out of range.
b) If the operator is division and the approximate mathematical result
of the operation represented with the precision and scale of the result
data type loses one or more leading significant digits after rounding or
truncating if necessary, then an exception condition is raised: data
exception numeric value out of range. The choice of whether to round
or truncate is implementation-defined.
%%%%
Or am I misreading the spec?
-Neil