Skip site navigation (1) Skip section navigation (2)

Re: precision and scale functions for numeric

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: precision and scale functions for numeric
Date: 2012-04-30 19:39:43
Message-ID: CA+TgmoaW8ZZh1CTawE_wVfMeo5ebhCLeCBQ=LTLo_uSSTiamcA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, Apr 30, 2012 at 3:33 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:
>> -----Original Message-----
>> From: pgsql-hackers-owner(at)postgresql(dot)org [mailto:pgsql-hackers-
>> owner(at)postgresql(dot)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

In response to

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2012-04-30 19:40:41
Subject: Re: precision and scale functions for numeric
Previous:From: Robert HaasDate: 2012-04-30 19:38:56
Subject: Re: Future In-Core Replication

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group