Skip site navigation (1) Skip section navigation (2)

Re: [BUGS] BUG #2108: Function with OUT parameters not recognized, using plpgsql

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Stallone <stallone(at)pobox(dot)com>
Cc: Bugs <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2108: Function with OUT parameters not recognized, using plpgsql
Date: 2005-12-12 15:31:07
Message-ID: 20051212153107.GK19555@surnet.cl (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Stallone wrote:

Please keep replies on the list.

> What you have done is run a SELECT which evaluates the function
> f_multiparam() passing it two parameters, and then takes the result and
> puts it INTO a local parameter.  This is not the same.  An OUT parameter
> is actually passed to the function and is part of the function
> specification, in this case it is defined as the third parameter.  It's
> like a placeholder within the definition of the function itself, and it
> should show up on the list of parameters for that function.  You can, in
> fact, have many OUT parameters in one function.  This is an advantage of
> out parameters over just a plain function with a single RETURN element.
> 
> At least this is how it has always worked for me.

Has always worked where?  In Postgres?  It's strange that you mention
"always" because OUT parameters are new in Postgres 8.1.  Behavior in
other database systems is not directly applicable to Postgres.

Keep in mind that in Postgres we don't have host variables, which is
what is needed to make OUT params work the way you are assuming they do.
This could be improved in the future but currently that's the way it is.

-- 
Alvaro Herrera                 http://www.amazon.com/gp/registry/CTMLCN8V17R4
Thou shalt check the array bounds of all strings (indeed, all arrays), for
surely where thou typest "foo" someone someday shall type
"supercalifragilisticexpialidocious" (5th Commandment for C programmers)

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2005-12-12 15:32:51
Subject: Re: BUG #2107: Function INOUT parameter not returned to caller, causes plpgsql malfunctions
Previous:From: Alvaro HerreraDate: 2005-12-12 14:08:36
Subject: Re: BUG #2108: Function with OUT parameters not recognized, using plpgsql

pgsql-patches by date

Next:From: Tom LaneDate: 2005-12-12 15:34:06
Subject: Re: BUG #2108: Function with OUT parameters not recognized, using plpgsql
Previous:From: Bruce MomjianDate: 2005-12-12 15:13:13
Subject: Re: farsi translation of postgresql FAQ updated

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group