Re: Usage of function retruning record in query - Mailing list pgsql-sql

From lists-pgsql@useunix.net
Subject Re: Usage of function retruning record in query
Date
Msg-id 20110704192801.GK13621@slacker.ja10629.home
Whole thread Raw
In response to Re: Usage of function retruning record in query  (lists-pgsql@useunix.net)
List pgsql-sql
Never mind, turns out you can do it with the array subscript operator. I
stumbled on to this by chance. I don't know if this is in the
documentation somewhere and I perhaps missed it?

On Mon, Jul 04, 2011 at 02:31:52PM -0400, lists-pgsql@useunix.net wrote:
> Sorry, I don't have a useful answer but I have a similar question.
> 
> Along these same lines how does one access the discreet x,y components
> of type 'point'?
> 
> 
> On Mon, Jul 04, 2011 at 06:59:49AM -0700, gmb wrote:
> > 
> > Harald Fuchs-10 wrote:
> > > In article <1309762075448-4549140.post@n5.nabble.com>,gmb
> > > <gmbouwer@gmail.com> writes:
> > > SELECT itemid, (calcvalues(itemid)).* FROM itemlist
> > > 
> > 
> > Thanks for the feedback, Harald.
> > 
> > How about specifying different aliases to the resulting values?
> > This will be handy when I use the same function multiple times in the same
> > query. 
> > (the function will take another input parameters used in the calculations)
> > 
> > E.g.:
> > SELECT itemid, (calcvalues(itemid, '2011-06-06')).*, (calcvalues(itemid,
> > '2011-06-07')).* FROM itemlist;
> > 
> >  itemid | calcval1 | calcval2 | calcval1 | calcval2
> > --------+----------+----------+----------+---------- 
> >       4 | 0.67     | 10.00    | 0.64     | 65.23 
> >       5 | 1.55     | 45.00    | 1.23     | 23.25 
> >       6 | 3.60     | 69.00    | 2.98     | 62.66 
> > How will I manage unique column names for this output?
> > 
> > --
> > View this message in context:
http://postgresql.1045698.n5.nabble.com/Usage-of-function-retruning-record-in-query-tp4549140p4550092.html
> > Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
> > 
> > -- 
> > Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-sql
> 
> -- 
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql


pgsql-sql by date:

Previous
From: lists-pgsql@useunix.net
Date:
Subject: Re: Usage of function retruning record in query
Next
From: gmb
Date:
Subject: Re: Usage of function retruning record in query