Re: How to Declare Functions Containing OUT PArameters? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to Declare Functions Containing OUT PArameters?
Date
Msg-id 10851.1279134964@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to Declare Functions Containing OUT PArameters?  ("Joshua D. Drake" <jd@commandprompt.com>)
Responses Re: How to Declare Functions Containing OUT PArameters?  (Bill Thoen <bthoen@gisnet.com>)
List pgsql-general
"Joshua D. Drake" <jd@commandprompt.com> writes:
> On Wed, 2010-07-14 at 12:21 -0600, Bill Thoen wrote:
>> I'm having some difficulty getting plpgsql to recognize a function with
>> a couple of OUT parameters.

>> psql:ex_out_fail.sql:28: ERROR:  function fishy(text, text, integer,
>> real) does not exist

> You are passing four IN paramaters. The out paramaters are used in
> return are they not?

You'd need to do something like

SELECT * INTO num, fnum FROM fishy(str1, str2) ;

OUT parameters in PG are just syntactic sugar for defining a
record-returning function.  The call syntax still works as if you'd
written CREATE FUNCTION foo (IN-parameters-only) RETURNS some-record-type.

            regards, tom lane

pgsql-general by date:

Previous
From: Tim Landscheidt
Date:
Subject: Re: Need help doing a CSV import
Next
From: Anthony Presley
Date:
Subject: Index on a Decrypt / Bytea2Text Function