Re: Views versus user-defined functions: formatting, comments, performance, etc.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Views versus user-defined functions: formatting, comments, performance, etc.
Дата
Msg-id 10411.1345255214@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Views versus user-defined functions: formatting, comments, performance, etc.  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-general
"David Johnston" <polobo@yahoo.com> writes:
> Trying to answer the previous question this one presented itself:  I just
> tried a couple of very simple queries and couldn't get them give me a plan
> that wasn't a "Function Scan".  Is it possible that only "scalar" functions
> can be inlined?

> CREATE OR REPLACE FUNCTION three_col_func()
> RETURNS TABLE (col1 varchar, col2 varchar, col3 varchar)
> AS $$
>    SELECT '1'::varchar, '2'::varchar, '3'::varchar;
> $$
> LANGUAGE sql
> VOLATILE
> ROWS 1
> ;

No, the problem with that one is that it's marked VOLATILE, which has a
whole set of implications that wouldn't be replicated by an inline
subquery.  Try marking it STABLE instead.

There are a pile of other poorly-documented restrictions as well...
one that I notice in a quick look at inline_set_returning_function
is that the function can't be marked STRICT.

            regards, tom lane


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

Предыдущее
От: "David Johnston"
Дата:
Сообщение: Re: Views versus user-defined functions: formatting, comments, performance, etc.
Следующее
От: Evan Stanford
Дата:
Сообщение: Fwd: PSQL Help from your biggest fan