pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wade <wade@wavefire.com>
To: pgsql-sql@postgresql.org
Subject: pl/pgsql and returning rows
Date: Mon, 26 Mar 2001 11:59:09 -0800
Message-ID: <3.0.32.20010326115909.0194b810@mail.wavefire.com> (raw)

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



view thread (7+ messages)  latest in thread

Message-ID: <3.0.32.20010326115909.0194b810@mail.wavefire.com>
Permalink:  ../3.0.32.20010326115909.0194b810@mail.wavefire.com/
Also on:    postgresql.org/message-id/3.0.32.20010326115909.0194b810@mail.wavefire.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: wade@wavefire.com
  Subject: Re: pl/pgsql and returning rows
  In-Reply-To: <3.0.32.20010326115909.0194b810@mail.wavefire.com>
  References: <3.0.32.20010326115909.0194b810@mail.wavefire.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox