Re: precision and scale functions for numeric

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: precision and scale functions for numeric
Дата
Msg-id CA+TgmoaW8ZZh1CTawE_wVfMeo5ebhCLeCBQ=LTLo_uSSTiamcA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: precision and scale functions for numeric  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-hackers
On Mon, Apr 30, 2012 at 3:33 PM, David Johnston <polobo@yahoo.com> wrote:
>> -----Original Message-----
>> From: pgsql-hackers-owner@postgresql.org [mailto:pgsql-hackers-
>> owner@postgresql.org] On Behalf Of Robert Haas
>> Sent: Monday, April 30, 2012 2:20 PM
>> To: Peter Eisentraut
>> Cc: pgsql-hackers
>> Subject: Re: [HACKERS] precision and scale functions for numeric
>>
>>
>> I think you could test for integer-ness by testing whether val % 0 = 0.
>>
>
> Either I am missing something here or you are.  Since Modulus is a division
> function anything "% 0" results in a division-by-zero ERROR - division has
> to occur before a remainder can be obtained.
>
> Maybe "val % 2 NOT IN (0,1)" ...

Oops.  I meant (val % 1) = 0, not (val % 0) = 0.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Future In-Core Replication
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: precision and scale functions for numeric