Re: return query/composite types

Поиск
Список
Период
Сортировка
Искать
От
Merlin Moncure
Тема
Re: return query/composite types
Дата
Msg-id
b42b73150902201225g2d4694b9kde94bcd931e64c9e@mail.gmail.com
Ответ на
Список
Дерево обсуждения
return query/composite types Merlin Moncure <mmoncure@gmail.com>
Re: return query/composite types Tom Lane <tgl@sss.pgh.pa.us>
Re: return query/composite types Merlin Moncure <mmoncure@gmail.com>
Re: return query/composite types Tom Lane <tgl@sss.pgh.pa.us>
Re: return query/composite types Merlin Moncure <mmoncure@gmail.com>
On Fri, Feb 20, 2009 at 3:00 PM, Tom Lane  wrote:
> Merlin Moncure  writes:
>> create table foo(a int, b int);
>> postgres=# create function rfoo() returns setof foo as $$ begin return
>> query select foo from foo; end; $$ language plpgsql;
>
> Use "select * from ..." instead.

Yeah...I was thinking maybe that shouldn't be required:
1. it's illogical and conflicts with regular non 'returns query'
semantics (declare foo, assign, return)
2. if 'foo' is result of set returning function (like unnest), you
need to make extra subquery to prevent that function from executing
lots of extra times.
e.g.
select unnest(foo) from  will unnest the set six times if
foo has six fields.  This is a bit of a landmine since type returning
functions are _fairly_ common use for composite types.

These aren't really complaints since the workarounds are trivial, just
casual wondering if the behavior is correct.

merlin

В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
От: Merlin Moncure
Дата:
FAQ