pl/pgsql and returning rows

From: wade <wade(at)wavefire(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: pl/pgsql and returning rows
Date: 2001-03-26 19:59:09
Message-ID: 3.0.32.20010326115909.0194b810@mail.wavefire.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Here is the senario...

I have a table defined as

create table details (
field1 <type>
field2 <type>
.
.
.
);

and a function:
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)

How do i get at the actual information in the row?
Is this type of function even possible?
If not, is there a different manner in which i should approach this task?

Thanx in advance.
-Wade

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Stephen Jackson 2001-03-26 20:03:55 Implicit/Explicit casting of the unknown type
Previous Message Josh Berkus 2001-03-26 19:55:59 Function Vanished