mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Detect overflow in integer arithmetic operators (integer, smallint, and
bigint variants). Clean up some inconsistencies in error message wording. Fix scanint8 to allow trailing whitespace in INT64_MIN case. Update int8-exp-three-digits.out, which seems to have been ignored by the last couple of people to modify the int8 regression test, and remove int8-exp-three-digits-win32.out which is thereby exposed as redundant.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.110 2004/09/02 17:12:50 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.111 2004/10/04 14:42:46 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1147,7 +1147,7 @@ dtoi2(PG_FUNCTION_ARGS)
|
||||
if ((num < SHRT_MIN) || (num > SHRT_MAX))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||
errmsg("integer out of range")));
|
||||
errmsg("smallint out of range")));
|
||||
|
||||
result = (int16) rint(num);
|
||||
PG_RETURN_INT16(result);
|
||||
@ -1213,7 +1213,7 @@ ftoi2(PG_FUNCTION_ARGS)
|
||||
if ((num < SHRT_MIN) || (num > SHRT_MAX))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||
errmsg("integer out of range")));
|
||||
errmsg("smallint out of range")));
|
||||
|
||||
result = (int16) rint(num);
|
||||
PG_RETURN_INT16(result);
|
||||
|
Reference in New Issue
Block a user