Received: from nezu.gs.verio.net (nezu.gs.verio.net [204.27.65.34]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2RLhYw99731 for ; Tue, 27 Mar 2001 16:43:34 -0500 (EST) (envelope-from jeckermann@verio.net) Received: by NEZU with Internet Mail Service (5.5.2650.21) id ; Tue, 27 Mar 2001 15:43:26 -0600 Message-ID: <08CD1781F85AD4118E0800A0C9B8580B0949DE@NEZU> From: Jeff Eckermann To: pgsql-sql@postgresql.org, wade Subject: RE: pl/pgsql and returning rows Date: Tue, 27 Mar 2001 15:43:22 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain X-Archive-Number: 200103/560 X-Sequence-Number: 2230 As a workaround, you can insert your row into an existing table, then retrieve it from there later. I think you need to enumerate all of the fields, as in 'INSERT INTO table VALUES (ret.field1, ret.field2,...ret.fieldn);'. At least, I haven't succeeded any other way. Messy, but the best method available right now. > -----Original Message----- > From: Richard Huxton [SMTP:dev@archonet.com] > Sent: Tuesday, March 27, 2001 2:27 AM > To: pgsql-sql@postgresql.org; wade > Subject: Re: pl/pgsql and returning rows > > From: "wade" > > > create function get_details(int4) returns details as ' > > declare > > ret details%ROWTYPE; > > site_rec record; > > cntct contacts%ROWTYPE; > > begin > > select into site_rec * sites_table where id = $1 limit 1; > > select into cntct * from contacts where id = site_rec.contact; > > > > -- and then i populate rows of ret. > > ret.name := cntct.name; > > ret.ip := site_rec.ip; > > . > > . > > . > > return ret; > > end; > > ' language 'plpgsql'; > > > > now the problem is when is when I do a: > > SELECT get_details(55); > > all i get is a single oid-looking return value: > > get_details > > ------------- > > 136295592 > > (1 row) > > Sorry - you can't return a row from a function at the present time (except > for trigger functions which are special) although I believe this is on the > todo list for a later 7.x release. > > Just from the top of my head, you might try a view with a select rule, > although I'm not completely clear what your objectives are. > > - Richard Huxton > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org