Received: from www-uk-05.digiserve.com ([195.97.231.11]) by mail.postgresql.org (8.11.3/8.11.1) with ESMTP id f2R8YDw54921 for ; Tue, 27 Mar 2001 03:34:13 -0500 (EST) (envelope-from dev@archonet.com) Received: from mainbox.archonet.com (mwynhau.demon.co.uk [193.237.186.96]) by www-uk-05.digiserve.com (8.9.1/8.9.1) with ESMTP id JAA17021; Tue, 27 Mar 2001 09:35:09 +0100 (BST) Received: from client (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with SMTP id A2F072A686; Tue, 27 Mar 2001 09:26:50 +0100 (BST) Message-ID: <00b701c0b697$ab527a40$1001a8c0@archonet.com> From: "Richard Huxton" To: , "wade" References: <3.0.32.20010326115909.0194b810@mail.wavefire.com> Subject: Re: pl/pgsql and returning rows Date: Tue, 27 Mar 2001 09:26:47 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Archive-Number: 200103/544 X-Sequence-Number: 2214 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