Upgrading from 7.1.2 to 7.3.3 - function may need to add explicit typecasts - Mailing list pgsql-novice

From Stuart Woodward
Subject Upgrading from 7.1.2 to 7.3.3 - function may need to add explicit typecasts
Date
Msg-id 20030827174720.3BFD.WOODWARD@garage.co.jp
Whole thread Raw
Responses Re: Upgrading from 7.1.2 to 7.3.3 - function may need to add explicit typecasts
List pgsql-novice
I have just reinstalled a database which has been working fine on
version 7.1.2 to 7.3.3 does anyone have any idea where and what typecast
I need to apply to get this test code work again?

--------------
1. The exception that I am getting is as follows:

java.sql.SQLException: ERROR:  Function calcprice(numeric, integer, numeric) does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts
----------------------------------
2. The code that is being called is as follows:

String sql = "select calcPrice(?,?,?) ";
PreparedStatement st = getCon().prepareStatement(sql);
st.setDouble(1, listPrice);
st.setInt(2, type);
st.setDouble(3, amount);
rs = st.executeQuery();

----------------------------------
3. The SQL used to creat the function is as follows:

CREATE FUNCTION calcprice (float8, smallint, float8)
RETURNS float8 AS
SELECT float8larger(0, CASE
WHEN $2 = 1 THEN $1 - $3
WHEN $2 = 2 THEN $1 *(1 - $3)
ELSE $3
END )'
LANGUAGE 'sql'
----------------
4. From psql the function looks like this

test=> \df calcprice
                                  List of functions
 Result data type | Schema |   Name    |             Argument data types
------------------+--------+-----------+----------------------------------------------
 double precision | public | calcprice | double precision, smallint, double precision
(1 row)



pgsql-novice by date:

Previous
From: Tomka Gergely
Date:
Subject: Re: Database names and pg_dump
Next
From: Michael Guerin
Date:
Subject: Simple queries take forever to run