Re: [HACKERS] precision and scale functions for numeric

2012-04-30 Thread Kevin Grittner
"David Johnston" wrote: >> I think you could test for integer-ness by testing whether val % 0 = 0. > Modulus is a division function anything "% 0" results in a division-by-zero It seems pretty clear that he meant "% 1". test=# select '1.01'::numeric % 1; ?column? -- 0.01 (1

Re: [HACKERS] precision and scale functions for numeric

2012-04-30 Thread Robert Haas
gt;> 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 >

Re: [HACKERS] precision and scale functions for numeric

2012-04-30 Thread David Johnston
> -Original Message- > From: pgsql-hackers-ow...@postgresql.org [mailto:pgsql-hackers- > ow...@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

Re: [HACKERS] precision and scale functions for numeric

2012-04-30 Thread Robert Haas
On Sun, Apr 29, 2012 at 1:51 PM, Peter Eisentraut wrote: > I didn't find a good way to find out how many digits a numeric value has > or things like whether a numeric value is an integer.  (I had to go > through bc(1) for the latter.)  Functions like precision() and scale() > would have been quite

[HACKERS] precision and scale functions for numeric

2012-04-29 Thread Peter Eisentraut
I didn't find a good way to find out how many digits a numeric value has or things like whether a numeric value is an integer. (I had to go through bc(1) for the latter.) Functions like precision() and scale() would have been quite handy. Are there other ways to do this, or would this make a goo