From: Richard Huxton <dev@archonet.com>
To: oliverp21@free.fr
Cc: pgsql-sql@postgresql.org
Subject: Re: Problem with returning setof record
Date: Tue, 07 Sep 2004 18:35:51 +0100
Message-ID: <413DF177.1060407@archonet.com> (raw)
In-Reply-To: <1094577194.413dec2a05bc4@imp1-q.free.fr>
References: <1094577194.413dec2a05bc4@imp1-q.free.fr>
oliverp21@free.fr wrote:
> Hello,
>
> Here is a simple function I created for a test.
>
> create function ttt() returns setof record as '
> When I try to use it, it returns to me :
>
> select ttt();
> set-valued function called in context that cannot accept a set
> : PL/pgSQL function "ttt" line 5 at return next
>
> Anyone has an idea ?
You need to treat it like a table:
SELECT * FROM ttt();
Also, I'm not sure you can return a setof anonymous record types (unless
you can specify the structure in the select).
Try CREATE FUNCTION...RETURNS SETOF utilisateurs.menus
If there's no appropriate table you can use CREATE TYPE to create a
structure.
--
Richard Huxton
Archonet Ltd
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, oliverp21@free.fr
Subject: Re: Problem with returning setof record
In-Reply-To: <413DF177.1060407@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