Re: SQL error: function round(double precision, integer) does

Поиск
Список
Период
Сортировка
От TJ O'Donnell
Тема Re: SQL error: function round(double precision, integer) does
Дата
Msg-id 422350F6.1050106@acm.org
обсуждение исходный текст
Ответ на Re: SQL error: function round(double precision, integer) does not exist  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: SQL error: function round(double precision, integer) does  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
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) ...
> 


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

Предыдущее
От: Christoph Haller
Дата:
Сообщение: Re: SQL error: function round(double precision, integer) does not
Следующее
От: Aarni Ruuhimäki
Дата:
Сообщение: Re: Read count ?