Re: [SQL] Re: SQL error: function round(double precision, integer) does not exist
В списке pgsql-sql по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: [SQL] Re: SQL error: function round(double precision, integer) does not exist |
| Дата | |
| Msg-id | 16285.1495736557@sss.pgh.pa.us обсуждение |
| Ответ на | Re: [SQL] Re: SQL error: function round(double precision, integer)does not exist (Vladimir Nicolici <vladnc@gmail.com>) |
| Ответы |
Re: [SQL] Re: SQL error: function round(double precision, integer)does not exist
|
| Список | pgsql-sql |
Vladimir Nicolici <vladnc@gmail.com> writes:
> I do that, but its extremely annoying.
Well, if it rises to the level of extreme annoyance for you, there
is a simple solution:
create function round(float8, int) returns numeric as
'select round($1::numeric, $2)' language sql;
> Furthermore, since the single parameter version accepts double precision numbers, the imprecise representation excuse
seemsquestionable at best.
The single-parameter version always rounds to integer, which avoids the
problem of not being able to represent decimal fractions exactly.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера