Re: expression evaluation with expected datatypes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: expression evaluation with expected datatypes
Дата
Msg-id 20735.1341930709@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: expression evaluation with expected datatypes  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Ответы Re: expression evaluation with expected datatypes  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Dimitri Fontaine <dimitri@2ndQuadrant.fr> writes:
> We could imagine several syntax to show up the idea, common keywords
> here include LAMBDA, FLET or LABELS, but I think that expanding WITH
> would be preferable for us.

>   WITH FUNCTION foo(param list) returns rettype language foo AS (
>     definition here
>   )
>   <query using foo() here>;

I like this idea.  This gets rid of both the "how to pass parameters"
and the "how to return results" issues that exist with DO, as well as
assorted implementation problems that you hinted at by asking whether
DO would still be a utility command.

In the syntax-bikeshedding department, we'd still need the function body
to be a string literal, and I think we'd want the ability to add
options such as IMMUTABLE/VOLATILE.  So I'd be inclined to move all
these options inside the parentheses that the WITH syntax dictates.
Perhaps

WITH FUNCTION foo(paramlist) AS (returns intas $$ ... $$language plpgsql... other CREATE FUNCTION options as needed
...
)
query here ...
        regards, tom lane


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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Allow replacement of bloated primary key indexes without foreign key rebuilds
Следующее
От: Shaun Thomas
Дата:
Сообщение: Re: Synchronous Standalone Master Redoux