Anonymous code block with parameters

Поиск
Список
Период
Сортировка
От Kalyanov Dmitry
Тема Anonymous code block with parameters
Дата
Msg-id 1410849538.4296.19.camel@localhost
обсуждение исходный текст
Ответы Re: Anonymous code block with parameters  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Anonymous code block with parameters  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Список pgsql-hackers
I'd like to propose support for IN and OUT parameters in 'DO' blocks.

Currently, anonymous code blocks (DO statements) can not receive or
return parameters.

I suggest:

1) Add a new clause to DO statement for specifying names, types,
directions and values of parameters:

DO <code> [LANGUAGE <lang>] [USING (<arguments>)]

where <arguments> has the same syntax as in
'CREATE FUNCTION <name> (<arguments>)'.

Example:

do $$ begin z := x || y; end; $$
language plpgsql
using
( x text = '1', in out y int4 = 123, out z text
);

2) Values for IN and IN OUT parameters are specified using syntax for
default values of function arguments.

3) If DO statement has at least one of OUT or IN OUT parameters then it
returns one tuple containing values of OUT and IN OUT parameters.

Do you think that this feature would be useful? I have a
proof-of-concept patch in progress that I intend to publish soon.




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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: WAL format and API changes (9.5)
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Triconsistent catalog declaration