Re: Anonymous code block with parameters

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Anonymous code block with parameters
Дата
Msg-id 5417ED7D.4070509@2ndquadrant.com
обсуждение исходный текст
Ответ на 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
On 09/16/2014 03:15 PM, Pavel Stehule wrote:

> Why we don't introduce a temporary functions instead?

I think that'd be a lot cleaner and simpler. It's something I've
frequently wanted, and as Hekki points out it's already possible by
creating the function in pg_temp, there just isn't the syntax sugar for
"CREATE TEMPORARY FUNCTION".

So why not just add "CREATE TEMPORARY FUNCTION"?


It means two steps:

CREATE TEMPORARY FUNCTION ... $$ $$;

SELECT my_temp_function(blah);

but I'm not personally convinced that a parameterised DO block is much
easier, and the idea just rings wrong to me.


I agree with Pavel that the natural way to parameterise DO blocks, down
the track, will be to allow them to get (and set?) SQL-typed session
variables. Of course, we'd need to support them first ;-)

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Anonymous code block with parameters
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Anonymous code block with parameters