agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: bcschnei@attbi.com
Cc: david williams <dw_remote@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Stored Procedures
Date: Wed, 02 Oct 2002 11:09:20 -0700
Message-ID: <3D9B3650.3040000@joeconway.com> (raw)
References: <20021002175333.HITM18767.rwcrmhc53.attbi.com@rwcrwbc57>

bcschnei@attbi.com wrote:
> Ok, if this does not apply to versions prior to 7.3beta 
> then what do I need to do if I am running 7.2.1? When I 
> try to use the SETOF to retrun a row set, I only get 
> one column.

First, prior to 7.3 there is no SCHEMA support in Postgres. Everything lives 
in essentially one and the same schema.

In 7.2.x and before, returning a composite type (i.e. multiple columns) gives 
you back one column of pointers (large integer values) to the actual row of 
data. You can access the individual columns, but it's ugly:

test=# CREATE TABLE foo (fooid int, foosubid int, fooname text);
CREATE
test=# INSERT INTO foo VALUES(1,1,'Joe');
INSERT 304822 1
test=# CREATE FUNCTION getfoo(int) RETURNS foo AS '
test'#   SELECT * FROM foo WHERE fooid = $1;
test'# ' LANGUAGE SQL;
CREATE
test=# select fooid(getfoo(1)), foosubid(getfoo(1)), fooname(getfoo(1));
  fooid | foosubid | fooname
-------+----------+---------
      1 |        1 | Joe
(1 row)

Joe




view thread (23+ messages)  latest in thread

Message-ID: <3D9B3650.3040000@joeconway.com>
Permalink:  ../3D9B3650.3040000@joeconway.com/
Also on:    postgresql.org/message-id/3D9B3650.3040000@joeconway.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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mail@joeconway.com, bcschnei@attbi.com, dw_remote@hotmail.com
  Subject: Re: Stored Procedures
  In-Reply-To: <3D9B3650.3040000@joeconway.com>

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

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