Skip site navigation (1) Skip section navigation (2)

Re: Joining with result of a plpgsql function

From: "Matthew T(dot) O'Connor" <matthew(at)zeut(dot)net>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Joining with result of a plpgsql function
Date: 2008-05-08 05:21:52
Message-ID: 48228DF0.3010709@zeut.net (view raw or flat)
Thread:
Lists: 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!


In response to

pgsql-sql by date

Next:From: James RobinsonDate: 2008-05-08 13:27:52
Subject: Index to enforce non-overlapping ranges?
Previous:From: Stephan SzaboDate: 2008-05-08 04:07:19
Subject: Re: Joining with result of a plpgsql function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group