Re: return query/composite types

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: return query/composite types
Date: 2009-02-20 20:26:54
Message-ID: b42b73150902201226v28a81f38kd2122f8fcf356f89@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Feb 20, 2009 at 3:25 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Fri, Feb 20, 2009 at 3:00 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Merlin Moncure <mmoncure(at)gmail(dot)com> 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 <something> will unnest the set six times if

er,
select (unnest(foo)).* from <something> will unnest the set six times if
^^^

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-02-20 20:55:25 Re: return query/composite types
Previous Message Merlin Moncure 2009-02-20 20:25:55 Re: return query/composite types