Re: [SQL] Returning result sets.

From: Joe Conway <mail(at)joeconway(dot)com>
To: Michael Weaver <mweaver(at)corpusglobe(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org
Subject: Re: [SQL] Returning result sets.
Date: 2003-02-14 01:57:18
Message-ID: 3E4C4CFE.6090503@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2003-02-14 03:53:59 Re: Executing SQL commands in script files
Previous Message simran 2003-02-14 01:49:45 Re: Executing SQL commands in script files

Browse pgsql-sql by date

  From Date Subject
Next Message Frankie Lam 2003-02-14 02:59:49 Re: dblink question please
Previous Message Michael Weaver 2003-02-14 01:44:09 Returning result sets.