pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: terence.kearns@canberra.edu.au
Cc: pgsql-sql@postgresql.org
Subject: Re: returning a recordset from PLpg/SQL
Date: Wed, 09 Jun 2004 09:58:40 +0100
Message-ID: <40C6D140.8010701@archonet.com> (raw)
In-Reply-To: <4041DCBF.203@isd.canberra.edu.au>
References: <4041DCBF.203@isd.canberra.edu.au>
Terence Kearns wrote:
> Looking at the datatypes you can RETURN, it doesn't seem that there is a
> way to return a recordset
>
> I tried
> RETURNS SETOF RECORD
> but that doesn't work
>
> I even tried
> RETURNS SETOF fooTable%ROWTYPE
>
> What I would like to do is not that simple, I need to be able to
> build/declare a record definition with an arbitary list of columns and
> then return a set of that record which has it's values populated by
> queries and calculations inside the procedure.
Declare your datatype (CREATE TYPE ...) and return a SETOF that. What
you can't do is declare your datatype inside your function. Clearly
PostgreSQL needs to know what type is being returned while parsing the
function, so you can't have a "dynamic type" (if such an idea has any
meaning at all).
--
Richard Huxton
Archonet Ltd
view thread (11+ messages)
Message-ID: <40C6D140.8010701@archonet.com> Permalink: ../40C6D140.8010701@archonet.com/ Also on: postgresql.org/message-id/40C6D140.8010701@archonet.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: dev@archonet.com, terence.kearns@canberra.edu.au Subject: Re: returning a recordset from PLpg/SQL In-Reply-To: <40C6D140.8010701@archonet.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