Re: join from array or cursor

Поиск
Список
Период
Сортировка
От Sam Mason
Тема Re: join from array or cursor
Дата
Msg-id 20090821152255.GE5407@samason.me.uk
обсуждение исходный текст
Ответ на Re: join from array or cursor  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: join from array or cursor
Список pgsql-general
On Fri, Aug 21, 2009 at 10:49:52AM -0400, Merlin Moncure wrote:
> On Fri, Aug 21, 2009 at 10:17 AM, Sam Mason<sam@samason.me.uk> wrote:
> >   CREATE TYPE foo AS ( i int, j int );
> >
> >   SELECT (id((SELECT (1,2)::foo))).*;
> >
> > or am I missing something obvious?
>
> I think that what you are bumping in to is that there is no real
> definition of '*' in the query.  've griped about this a few times. If
> type 't' has fields a,b,
>
> select (t).* is expanded to select (t).a, (t).b.

OK, but that's not because of there being no "real definition" of *.
It seems perfectly well defined in the example above as a tuple of two
integers.  The thing that causes it to go wrong here is that PG doesn't
know that doing this expansion (as you noted above) can cause the query
to become very expensive.  PG should instead arrange that the expression
"t" is run exactly once and reuse the single result for all columns.

--
  Sam  http://samason.me.uk/

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

Предыдущее
От: David Waller
Дата:
Сообщение: "Number of columns exceed limit" on a hierarchy of views
Следующее
От: "Chris Hopkins"
Дата:
Сообщение: Re: Out of memory on pg_dump