pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: kevin@mtel.co.uk
To: pgsql-admin@postgresql.org
Subject: Re: user defined function call problem after upgrade 7.2.3 -> 7.3.2
Date: 20 May 2003 02:04:15 -0700
Message-ID: <6675f17.0305200104.441ee6de@posting.google.com> (raw)
References: <6675f17.0305190441.1c9a559d@posting.google.com>

kevin@mtel.co.uk (kevin) wrote in message news:<6675f17.0305190441.1c9a559d@posting.google.com>...
> hi,
> 
> iv'e recently upgraded and all seemed fine with our app until a user
> defined function was called today and we get the folowing error logged
> on out web server.
> 
> SELECT updateordhdr('     5',01,'2003-05-20','O     5  
> 12003-05-20','','','','','','',00,'O','O',00)
> Gave: java.sql.SQLException: ERROR:  Function updateordhdr("unknown",
> integer, "unknown", "unknown", "unknown", "unknown", "unknown",
> "unknown", "unknown", "unknown", integer, "unknown", "unknown",
> integer) does not exist
> 	Unable to identify a function that satisfies the given argument types
> 	You may need to add explicit typecasts
> 
> I've extracted the def from the db using pg_dump. I did not notice any
> error messages while loading the functions (as part of a restore). Is
> it complaining abouty the strings? I thought character and char
> varying didn't need casting, and they certainly didn't before.
> 
> Any ideas? 
> 
> --
> -- TOC entry 152 (OID 196117)
> -- Name: updateordhdr (character varying, smallint, date, character,
> character varying, character varying, character varying, character
> varying, character varying, character varying, smallint, character,
> character, integer); Type: FUNCTION; Schema: public; Owner: root
> --
> 
> CREATE FUNCTION updateordhdr (character varying, smallint, date,
> character, character varying, character varying, character varying,
> character varying, character varying, character varying, smallint,
> character, character, integer) RETURNS integer
>     AS ' DECLARE myaccount ALIAS FOR $1; mydelivery ALIAS FOR $2;
> mythedate ALIAS FOR $3; mytheorder ALIAS FOR $4; mydeliverynote ALIAS
> FOR $5; myinvoicenote ALIAS FOR $6; mygrnpod ALIAS FOR $7; mycomments
> ALIAS FOR $8; mydcomments ALIAS FOR $9; myround ALIAS FOR $10;
> mytempno ALIAS FOR $11; mystatus ALIAS FOR $12; myordertype ALIAS FOR
> $13; mytransno ALIAS FOR $14; mycount int4; BEGIN SELECT COUNT(*) INTO
> mycount FROM orderheader WHERE theorder=mytheorder; IF mycount=0 THEN
> INSERT INTO orderheader
> (account,delivery,thedate,theorder,deliverynote,invoicenote,grnpod,comments,dcomments,round,tempno,status,ordertype,transno)
> VALUES (myaccount,mydelivery,mythedate,mytheorder,mydeliverynote,myinvoicenote,mygrnpod,mycomments,mydcomments,myround,mytempno,mystatus,myordertype,mytransno);
> ELSE UPDATE orderheader SET
> account=myaccount,delivery=mydelivery,thedate=mythedate,theorder=mytheorder,deliverynote=mydeliverynote,invoicenote=myinvoicenote,grnpod=mygrnpod,comments=mycomments,dcomments=mydcomments,round=myround,tempno=mytempno,status=mystatus,ordertype=myordertype,transno=mytransno
> WHERE theorder=mytheorder; END IF; RETURN mycount; END; '
>     LANGUAGE plpgsql;
> 
> 
> --
> -- TOC entry 153 (OID 196117)
> -- Name: updateordhdr (character varying, smallint, date, character,
> character varying, character varying, character varying, character
> varying, character varying, character varying, smallint, character,
> character, integer); Type: ACL; Schema: public; Owner: root
> --
> 
> REVOKE ALL ON FUNCTION updateordhdr (character varying, smallint,
> date, character, character varying, character varying, character
> varying, character varying, character varying, character varying,
> smallint, character, character, integer) FROM PUBLIC;
> GRANT ALL ON FUNCTION updateordhdr (character varying, smallint, date,
> character, character varying, character varying, character varying,
> character varying, character varying, character varying, smallint,
> character, character, integer) TO PUBLIC;


the problem was the smallint fields. these are not auto converted and
the
function call has to be recoded to be
select fn(value::smallint, ...)

now it works fine. I'll add more updates if i find more non string
related update problems (these are covered by other posts).

Kev.



view thread (3+ messages)  latest in thread

Message-ID: <6675f17.0305200104.441ee6de@posting.google.com>
Permalink:  ../6675f17.0305200104.441ee6de@posting.google.com/
Also on:    postgresql.org/message-id/6675f17.0305200104.441ee6de@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: kevin@mtel.co.uk
  Subject: Re: user defined function call problem after upgrade 7.2.3 -> 7.3.2
  In-Reply-To: <6675f17.0305200104.441ee6de@posting.google.com>
  References: <6675f17.0305190441.1c9a559d@posting.google.com> <6675f17.0305200104.441ee6de@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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