pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Michael Weaver <mweaver@corpusglobe.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-novice@postgresql.org
Subject: Re: [SQL] Returning result sets.
Date: Thu, 13 Feb 2003 17:57:18 -0800
Message-ID: <3E4C4CFE.6090503@joeconway.com> (raw)
In-Reply-To: <3B663B41B350D311AEEF00A0C9254563201A6E@VISION1>
References: <3B663B41B350D311AEEF00A0C9254563201A6E@VISION1>

Michael Weaver wrote:
> How do I declare a stored function to return a result set. (ie set of
> records)
> 
> I can define a function returning " setof record "
> but I get an error:
> 
> A column definition list is required for functions returning RECORD
> 
> The docs(7.3)  seem to think that this should be ok.
> so what is wrong?

You need to look a bit closer at the docs ;-)

After declaring myfunc() to return setof record, try:

select * from my_func() AS (a int8, b int8, c numeric, d numeric);
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                           missing - "the column definition list"
HTH,

Joe




view thread (2+ messages)

Message-ID: <3E4C4CFE.6090503@joeconway.com>
Permalink:  ../3E4C4CFE.6090503@joeconway.com/
Also on:    postgresql.org/message-id/3E4C4CFE.6090503@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, mweaver@corpusglobe.com, pgsql-novice@postgresql.org
  Subject: Re: [SQL] Returning result sets.
  In-Reply-To: <3E4C4CFE.6090503@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox