| From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: return setof : alternatives to holder table | 
| Date: | 2010-08-15 10:20:02 | 
| Message-ID: | 20100815102002.GA31040@a-kretschmer.de | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
In response to zhong ming wu :
> Hello List,
> 
> I have a plpgsql function returning a set of records.  The record is
> effectively a join of some tables.
> 
> For example, table a (column a1,column a2,column a3,column a4)
> 
> table b(column b1,column b2,column b4)
> 
> I am returning a set of (a2,a4,b2). What I do now is to create a empty table
> 
> foo(column a2,column a4,column b2)
> 
> then in my function I have
> 
> record r foo%rowtype
> 
> I'm not happy with this solution because this foo tables has to be kept around
> 
> Thanks for any better solution to this
You can create a aown typ or you can use IN/OUT-Parameters. I'm
prefering IN/OUT-Parameters, see here:
http://www.postgresonline.com/journal/archives/129-Use-of-OUT-and-INOUT-Parameters.html
http://bytes.com/topic/postgresql/answers/674690-output-parameters-functions
Regards, Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG: 0x31720C99, 1006 CCB4 A326 1D42 6431  2EB0 389D 1DC2 3172 0C99
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Craig Ringer | 2010-08-15 11:57:56 | Re: return setof : alternatives to holder table | 
| Previous Message | Mike Christensen | 2010-08-15 10:18:31 | Re: return setof : alternatives to holder table |