Re: Function round(double precision, integer) - Fast backward compatibility solution - Mailing list pgsql-bugs

From Silvio Scarpati
Subject Re: Function round(double precision, integer) - Fast backward compatibility solution
Date
Msg-id mCIhPjIgEgnigImf7n9JLYzIsPHb@4ax.com
Whole thread Raw
In response to Function round(double precision, integer) does not exists trouble in 7.3.1, did work on 7.2.1  (Felipe Barousse Boué <fbarousse@piensa.com>)
List pgsql-bugs
Hi Felipe,

On 04 Jan 2003 13:58:13 -0600, you wrote:

>I am having trouble with a function round that used to work in 7.2.1
>
>PostgreSQL was updated to 7.3.1 from 7.2.1, the data was re-loaded into
>7.3.1 with no complaints from the DB engine but, at application run
>time, we do get the error:
>
>Function round(double precision, integer) does not exists
>
>Code executed and that worked fine in 7.2.1 is:
>
>select
>    clientes.id_cliente,

[...]

have you tried to follow the Tom Lane suggestion to explicit cast the
first parameter in the call to round function ?

Anyway, to avoid writing queries and triggers to port existing
database to newer versions of Postgres you can define the following
very simple function:

-----------------------------------------------------------------

create function round (double precision, integer) returns double
precision as '

       select cast(round(cast($1 as numeric),$2) as double precision);

' LANGUAGE SQL with(iscachable) ;

----------------------------------------------------------------


I hope this can help someone.


Regards,
                        Silvio Scarpati

pgsql-bugs by date:

Previous
From:
Date:
Subject: link missing
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #872: Cursor scrolling