Re: Out parameters handling - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Out parameters handling
Date
Msg-id 162867790903070851g6e09be72hf02883c7ecfa37c7@mail.gmail.com
Whole thread Raw
In response to Re: Out parameters handling  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Out parameters handling  (Rod Taylor <rod.taylor@gmail.com>)
List pgsql-hackers
2009/3/7 Robert Haas <robertmhaas@gmail.com>:
> On Sat, Mar 7, 2009 at 9:08 AM, Rod Taylor <rod.taylor@gmail.com> wrote:
>> It wouldn't be so bad if you could assign internal and external column names.
>>
>> Within the function you call the column "v_foo" but the caller of the
>> function receives column "foo" instead.
>>
>> OUT v_foo varchar AS "foo"
>>
>>
>> Another alternative is requiring a prefix like plout for the
>> replacement to occur:
>>
>> ( OUT foo varchar )
>>
>> BEGIN
>>  SELECT foo.somename INTO plout.foo FROM foo WHERE id = 10;
>>
>>  RETURN NEXT;
>>
>>  RETURN;
>> END;
>
> This is a good point.  Uglifying the parameter names is sort of OK for
> input parameters, but is much more annoying for output parameters.
>
> ...Robert
>

hello

actually - function name should be used as label now. This code is working:

postgres=# create or replace function fx2(a integer, out b integer,
out c integer) as $$                 begin                    fx2.b := a + 10; fx2.c := a + 30;
return;               end; $$ language plpgsql; 
CREATE FUNCTION
postgres=# select * from fx2(20);
┌────┬────┐
│ b  │ c  │
├────┼────┤
│ 30 │ 50 │
└────┴────┘
(1 row)

regards
Pavel Stehule


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: small parallel restore optimization
Next
From: Gregory Stark
Date:
Subject: Re: Out parameters handling