From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | bcschnei(at)attbi(dot)com |
Cc: | david williams <dw_remote(at)hotmail(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Stored Procedures |
Date: | 2002-10-02 18:09:20 |
Message-ID: | 3D9B3650.3040000@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
bcschnei(at)attbi(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jie Liang | 2002-10-02 19:06:04 | schedule of v7.3 |
Previous Message | Beth Gatewood | 2002-10-02 18:01:07 | Re: indexing on char vs varchar |