Re: [SQL] Usage of function retruning record in query

2011-07-05 Thread gmb
Pavel Stehule wrote: > > > npcps_201=# select * from (select 1,2,2,3) x (a,b,c,d); > > That is a neat trick - one I didn't know of. Thanks Pavel -- View this message in context: http://postgresql.1045698.n5.nabble.com/Usage-of-function-retruning-record-in-query-tp4549140p4552618.html Sent

Re: [SQL] Usage of function retruning record in query

2011-07-05 Thread Pavel Stehule
2011/7/5 gmb : > > gmb wrote: >> >> >> 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 calcu

Re: [SQL] Usage of function retruning record in query

2011-07-05 Thread gmb
gmb wrote: > > > 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.: >

Re: [SQL] Usage of function retruning record in query

2011-07-04 Thread lists-pgsql
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-pg...@useunix.net wrote: > Sorry, I don't have a useful answer but

Re: [SQL] Usage of function retruning record in query

2011-07-04 Thread lists-pgsql
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.p...@n5.nabble.com>,gm

Re: [SQL] Usage of function retruning record in query

2011-07-04 Thread gmb
Harald Fuchs-10 wrote: > In article <1309762075448-4549140.p...@n5.nabble.com>,gmb > 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 us

Re: [SQL] Usage of function retruning record in query

2011-07-04 Thread Harald Fuchs
In article <1309762075448-4549140.p...@n5.nabble.com>, gmb writes: > Hi I have a stored function returning a record consisting of two field, > and receiving as input a single identifier: CREATE FUNCTION calcvalues(IN > itemid VACHAR, OUT calcval1 NUMERIC, OUT calcval2 NUMERIC) RETURNS > record...