Re: Out parameters handling
От | Pavel Stehule |
---|---|
Тема | Re: Out parameters handling |
Дата | |
Msg-id | 162867790903070851g6e09be72hf02883c7ecfa37c7@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Out parameters handling (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: Out parameters handling
|
Список | 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 по дате отправления: