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@xxxxxxxxxxxxx> 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/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general