Re: Function round(double precision, integer) - Fast backward compatibility solution

From: Silvio Scarpati <silvio(dot)scarpati(at)virgilio(dot)it>
To: Felipe Barousse Boué <fbarousse(at)piensa(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Function round(double precision, integer) - Fast backward compatibility solution
Date: 2003-01-12 09:37:23
Message-ID: mCIhPjIgEgnigImf7n9JLYzIsPHb@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrzej Kosmala 2003-01-12 21:46:54 "ERROR: Query-specified return tuple and actual function return tuple do not match" after dropping column
Previous Message pgsql-bugs 2003-01-11 12:34:47 Bug #871: FW: How to solve the problem