agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: TJ O'Donnell <tjo@acm.org>
To: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL error: function round(double precision, integer) does
Date: Mon, 28 Feb 2005 09:12:22 -0800
Message-ID: <422350F6.1050106@acm.org> (raw)
In-Reply-To: <20050228163309.GA105@winnie.fuhr.org>
References: <4222570F.5080901@acm.org>
	<20050228163309.GA105@winnie.fuhr.org>

I got round(numeric,int) working OK, but it's got me thinking (a dangerous thing!).
Is there some fundamental reason for round(dp) but round(numeric,int)?
Shouldn't they be, at least, consistent, having round(numeric)
or round(dp,int)?
Am I missing something?

Thanks,
TJ

Michael Fuhr wrote:
> On Sun, Feb 27, 2005 at 03:26:07PM -0800, TJ O'Donnell wrote:
> 
> 
>>ERROR:  function round(double precision, integer) does not exist
> 
>                          ^^^^^^^^^^^^^^^^
> [snip]
> 
> 
>>The functions described at:
>>http://www.postgresql.org/docs/7.4/static/functions-math.html
>>show that round(numeric,int) should work ok.
> 
>                   ^^^^^^^
> 
> The two-argument form of round() expects the first argument to be
> numeric, not double precision.  There's no implicit cast from double
> precision to numeric, so you'll have to use an explicit cast:
> 
> SELECT ... round((expression)::numeric, 2) ...
> 



view thread (16+ messages)  latest in thread

Message-ID: <422350F6.1050106@acm.org>
Permalink:  ../422350F6.1050106@acm.org/
Also on:    postgresql.org/message-id/422350F6.1050106@acm.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tjo@acm.org, mike@fuhr.org
  Subject: Re: SQL error: function round(double precision, integer) does
  In-Reply-To: <422350F6.1050106@acm.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox