Re: Returning result sets. - Mailing list pgsql-sql

From Joe Conway
Subject Re: Returning result sets.
Date
Msg-id 3E4C4CFE.6090503@joeconway.com
Whole thread Raw
In response to Returning result sets.  (Michael Weaver <mweaver@corpusglobe.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Michael Weaver
Date:
Subject: Returning result sets.
Next
From: "Frankie Lam"
Date:
Subject: Re: dblink question please