Обсуждение: bigint overflow 'feature'

Поиск
Список
Период
Сортировка

bigint overflow 'feature'

От
Allan Engelhardt
Дата:
Just wondering: Is this a known 'feature' & is there a workaround (to catch the overflow and abort the txn)??:

www=# select bigint '9223372036854775807' - bigint '-9223372036854775807';
 ?column?
----------
       -2
(1 row)


PostgreSQL 7.1.3 just downloaded.


Allan.

Re: bigint overflow 'feature'

От
Tom Lane
Дата:
Use NUMERIC if you're concerned about overflow.  The integer datatypes
are just C integers, and C doesn't provide any reasonable way to detect
overflow in integer arithmetic...

            regards, tom lane