Re: Out parameters handling

Поиск
Список
Период
Сортировка
От Asko Oja
Тема Re: Out parameters handling
Дата
Msg-id ecd779860903081150w44a28d96x2b64f75cc8bb0159@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Out parameters handling  (Dimitri Fontaine <dfontaine@hi-media.com>)
Список pgsql-hackers


On Sat, Mar 7, 2009 at 9:29 PM, Dimitri Fontaine <dfontaine@hi-media.com> wrote:
In fact, maybe a new option to set the OUT parameters prefix to use from within the function body would do?

Le 7 mars 09 à 19:56, Dimitri Fontaine a écrit :

CREATE OR REPLACE FUNCTION test_out
(
 IN  a integer,
 IN  b integer,
 OUT s integer
)
RETURNS setof integer

 SET out_prefix TO 'v_'

LANGUAGE PLPGSQL
AS $f$

That's what we also would like to have. In addition it should also make out parameters unusable without that prefix.  Then we could make it our coding standard and feel relatively safe again.

Those two following lines would be deprecated:


DECLARE
 v_s ALIAS FOR $3;


BEGIN
 FOR v_s IN SELECT generate_series(a, b)
 LOOP
  v_s := v_s * v_s;
  RETURN NEXT;
 END LOOP;
 RETURN;
END;
$f$;

CREATE FUNCTION
dim=# SELECT * FROM test_out(2, 4);
s
----
 4
 9
16
(3 rows)

--
dim


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: Potential problem with HOT and indexes?
Следующее
От: "Dickson S. Guedes"
Дата:
Сообщение: Re: ERROR: "failed to locate grouping columns"