pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Function that exists doesn't exist?
2+ messages / 2 participants
[nested] [flat]

* Function that exists doesn't exist?
@ 2006-02-10 06:26 Rob Johnston <rob@aqq.com.au>
  2006-02-11 16:55 ` Re: Function that exists doesn't exist? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Rob Johnston @ 2006-02-10 06:26 UTC (permalink / raw)
  To: pgsql-jdbc

Howdy,

A little dumbfounded by this error message when trying to update a table in postgres 8.1, using the 8.1-404 JDBC3 driver. We're also running Java 1.5.0-05.

Java throws this exception:
org.postgresql.util.PSQLException: ERROR: function update_payable_account(integer, character varying, character varying, character varying, integer, numeric, integer) does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1512)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1297)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:430)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:346)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:297)

Our function looks like this:
CREATE OR REPLACE FUNCTION update_payable_account(id int4, name "varchar", sup bpchar, cus bpchar, terms int2, del "numeric", astat int4)
  RETURNS void AS
$BODY$
begin
    update suppliers
    set
        supplier_name   = name,
        supplier_key  = sup,
        suppliers_customer_key  = cus,
        purchase_terms_id  = terms,
        delivery_charge  = del,
        account_status_id   = astat
    where supplier_id = id;
end;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION update_payable_account(id int4, name "varchar", sup bpchar, cus bpchar, terms int2, del "numeric", astat int4) OWNER TO postgres;

And our calling code like this:
   sql = conn.prepareCall("{ call update_payable_account(?, ?, ?, ?, ?, ?, ?) }");
   sql.setInt(1, account.getAccountNumber());
   sql.setString(2, account.getName());
   sql.setString(3, account.getSupplierKey());
   sql.setString(4, account.getCustomerKey());
   sql.setInt(5, account.getPurchaseTermsID());
   sql.setBigDecimal(6, new BigDecimal(account.getDelivery()));   // this is a double
   sql.setInt(7, account.getAccountStatusID());

Cheers,

Rob Johnston.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Function that exists doesn't exist?
  2006-02-10 06:26 Function that exists doesn't exist? Rob Johnston <rob@aqq.com.au>
@ 2006-02-11 16:55 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2006-02-11 16:55 UTC (permalink / raw)
  To: Rob Johnston <rob@aqq.com.au>; +Cc: pgsql-jdbc

"Rob Johnston" <rob@aqq.com.au> writes:
> org.postgresql.util.PSQLException: ERROR: function =
> update_payable_account(integer, character varying, character varying, =
> character varying, integer, numeric, integer) does not exist

> Our function looks like this:
> CREATE OR REPLACE FUNCTION update_payable_account(id int4, name =
> "varchar", sup bpchar, cus bpchar, terms int2, del "numeric", astat =
> int4)

int2 is not integer, and bpchar is not varchar.  There is an implicit
cast from varchar to bpchar, but not from int4 to int2.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-02-11 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-10 06:26 Function that exists doesn't exist? Rob Johnston <rob@aqq.com.au>
2006-02-11 16:55 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox