Upgrading from 7.1.2 to 7.3.3 - function may need to add explicit typecasts

From: Stuart Woodward <woodward(at)garage(dot)co(dot)jp>
To: pgsql-novice(at)postgresql(dot)org
Subject: Upgrading from 7.1.2 to 7.3.3 - function may need to add explicit typecasts
Date: 2003-08-27 08:58:08
Message-ID: 20030827174720.3BFD.WOODWARD@garage.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tomka Gergely 2003-08-27 11:28:41 Re: Database names and pg_dump
Previous Message JohnH 2003-08-26 23:48:03 using dates in pgsql