Re: Joining with result of a plpgsql function - Mailing list pgsql-sql

From Matthew T. O'Connor
Subject Re: Joining with result of a plpgsql function
Date
Msg-id 48228DF0.3010709@zeut.net
Whole thread Raw
In response to Re: Joining with result of a plpgsql function  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-sql
Stephan Szabo wrote:
> On Wed, 7 May 2008, Matthew T. O'Connor wrote:
>   
>> But I would really like to be able to combine it with other data and get
>> a result set that looked like:
>>
>> f.id, f.name, tms_summary.col1, tms_summary.col2 ...
>>     
>
> Well I think
>  select f.id, f.name, (tms.get_tms_summary(f.id)).* from foo f;
> would expand it out into separate columns, but I think that might also
> call it multiple times.  You might have better luck combining that with a
> subquery like
>  select id, name, (summary).col1, (summary).col2, ... from
>   (select id, name, tms.get_tms_summary(f.id) as summary from foo) f;

Ah, I knew there was an easy way to do it, I totally forgot / missed / 
didn't know about the (composite type).* syntax.

Thank you!



pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Joining with result of a plpgsql function
Next
From: James Robinson
Date:
Subject: Index to enforce non-overlapping ranges?