Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 11C22B5DC04 for ; Mon, 4 Jul 2011 16:28:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 36887-04 for ; Mon, 4 Jul 2011 19:28:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from eastrmfepo202.cox.net (eastrmfepo202.cox.net [68.230.241.217]) by mail.postgresql.org (Postfix) with ESMTP id 6104AB5DBFD for ; Mon, 4 Jul 2011 16:28:05 -0300 (ADT) Received: from eastrmimpo02.cox.net ([68.1.16.120]) by eastrmfepo202.cox.net (InterMail vM.8.01.04.00 201-2260-137-20101110) with ESMTP id <20110704192804.UJUM32466.eastrmfepo202.cox.net@eastrmimpo02.cox.net> for ; Mon, 4 Jul 2011 15:28:04 -0400 Received: from slacker.ja10629.home ([68.106.109.147]) by eastrmimpo02.cox.net with bizsmtp id 3vU11h00M3Ar1Vg02vU1GR; Mon, 04 Jul 2011 15:28:04 -0400 X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020204.4E121444.008F,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=1.1 cv=5b/QVZoDi0k1AX8Vn5wfxQWDHHxdqMUGvpDELxVbSDQ= c=1 sm=1 a=z1TLwsU0kBEA:10 a=bzbpU1KvNssA:10 a=PjkiJtDTOQ4A:10 a=ZcFhQy0-F_sA:10 a=kj9zAlcOel0A:10 a=sXZhTwfwSKhiTs9RzZXpNQ==:17 a=P6M1L9rJAAAA:8 a=9I5xiGouAAAA:8 a=pGLkceISAAAA:8 a=epTmVMiNAAAA:8 a=GFtSlv9eCshLmAo-1hkA:9 a=--21CyPYynb7vLtJrA0A:7 a=CjuIK1q_8ugA:10 a=Du3yRyqOjqsA:10 a=2fPOlPt4dusA:10 a=V_iEmhlNuOsA:10 a=MSl-tDqOz04A:10 a=YObXiYvaVLwA:10 a=sXZhTwfwSKhiTs9RzZXpNQ==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none Received: from wcuddy by slacker.ja10629.home with local (Exim 4.72) (envelope-from ) id 1QdooL-0005SB-GK for pgsql-sql@postgresql.org; Mon, 04 Jul 2011 15:28:01 -0400 Date: Mon, 4 Jul 2011 15:28:01 -0400 From: lists-pgsql@useunix.net To: pgsql-sql@postgresql.org Subject: Re: Usage of function retruning record in query Message-ID: <20110704192801.GK13621@slacker.ja10629.home> References: <1309762075448-4549140.post@n5.nabble.com> <868vseduyv.fsf@mgm.protecting.net> <1309787989162-4550092.post@n5.nabble.com> <20110704183152.GJ13621@slacker.ja10629.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110704183152.GJ13621@slacker.ja10629.home> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.778 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201107/5 X-Sequence-Number: 35575 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