Re: Cast double precision to integer & check for overflow

Поиск
Список
Период
Сортировка
От Jasen Betts
Тема Re: Cast double precision to integer & check for overflow
Дата
Msg-id ke268p$ab2$1@gonzo.reversiblemaps.ath.cx
обсуждение исходный текст
Ответ на Cast double precision to integer & check for overflow  (Ian Pilcher <arequipeno@gmail.com>)
Список pgsql-general
On 2013-01-26, Ian Pilcher <arequipeno@gmail.com> wrote:
> I need to cast a double precision into an integer, and I want to check
> that the value will actually fit (modulo rounding).
>
> Coming from a C/Java background, this seems like something that should
> be utterly trivial.  In my searching, however, I can't seem to find any
> SQL equivalent of INT_MAX, Integer.MAX_VALUE, etc.
>
> Do I have to hard-code this value?

yes, I think so, the documentation lists the limits here:

http://www.postgresql.org/docs/9.2/interactive/datatype-numeric.html

They are most unlikely to ever change. A new type would probably be added
instead.

--
⚂⚃ 100% natural

В списке pgsql-general по дате отправления:

Предыдущее
От: Steve Clark
Дата:
Сообщение: Re: noobie question
Следующее
От: pamkiki
Дата:
Сообщение: Re: Temporary schemas