round(real,integer)

From: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: round(real,integer)
Date: 2014-01-10 20:10:29
Message-ID: etPan.52d053b5.6b68079a.125ef@Butterfly.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

History question:
Why does select round(3,3) work, 
         select round(3.0,3) work, 
but      select round(3.0::real,1) not work?

There's a utility cast in the integer case (described here http://www.postgresql.org/docs/9.3/static/typeconv-func.html), but not in the real case.
Is this on purpose, or just an oversight? 
Obviously one can work around it, but I'm sick of doing so, it makes my SQL examples ugly. I’d like to fix it, but not if there’s a reason it’s not supposed to be done.
P.

--
Paul Ramsey
http://cleverelephant.ca
http://postgis.net

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Preston Hagar 2014-01-10 20:33:46 Re: Question about memory usage
Previous Message Tomas Vondra 2014-01-10 19:40:51 Re: Question about memory usage