Re: [GENERAL] function with multiple return values

2010-11-07 Thread Pavel Stehule
2010/11/7 Scott Serr : > On 11/07/2010 08:53 AM, Tom Lane wrote: >> >> Andreas Kretschmer  writes: >>> >>> Scott Serr  wrote: Ideas on how to uniquely name the first and second set of "perc, entry_date"? >>> >>> You can use alias-names for the 2 queries, like: >>> test=*# select foob

Re: [GENERAL] function with multiple return values

2010-11-07 Thread Scott Serr
On 11/07/2010 08:53 AM, Tom Lane wrote: Andreas Kretschmer writes: Scott Serr wrote: Ideas on how to uniquely name the first and second set of "perc, entry_date"? You can use alias-names for the 2 queries, like: test=*# select foobar.a as x, foobar.b as y, bar.* from (select * from foo()) f

Re: [GENERAL] function with multiple return values

2010-11-07 Thread Andreas Kretschmer
Tom Lane wrote: > Andreas Kretschmer writes: > > Scott Serr wrote: > >> Ideas on how to uniquely name the first and second set of "perc, > >> entry_date"? > > > You can use alias-names for the 2 queries, like: > > > test=*# select foobar.a as x, foobar.b as y, bar.* from (select * from > >

Re: [GENERAL] function with multiple return values

2010-11-07 Thread Tom Lane
Andreas Kretschmer writes: > Scott Serr wrote: >> Ideas on how to uniquely name the first and second set of "perc, >> entry_date"? > You can use alias-names for the 2 queries, like: > test=*# select foobar.a as x, foobar.b as y, bar.* from (select * from foo()) > foobar, (select * from foo()

Re: [GENERAL] function with multiple return values

2010-11-07 Thread Andreas Kretschmer
Scott Serr wrote: > I've created the following function: > > CREATE OR REPLACE FUNCTION latest ( lot_id int4, > condition text, OUT perc smallint, OUT entry_date date ) > RETURNS SETOF record AS > ' > BEGIN >RETURN QUERY SELECT t1.perc, t1.entry_date > FROMt1, t2 > W

[GENERAL] function with multiple return values

2010-11-07 Thread Scott Serr
I've created the following function: CREATE OR REPLACE FUNCTION latest ( lot_id int4, condition text, OUT perc smallint, OUT entry_date date ) RETURNS SETOF record AS ' BEGIN RETURN QUERY SELECT t1.perc, t1.entry_date FROMt1, t2 WHERE t1.condition_id=t2.id and t1.lo