Re: Getting the return type right for SETOF - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Getting the return type right for SETOF
Date
Msg-id 20030830135853.I74114-100000@megazone.bigpanda.com
Whole thread Raw
In response to Getting the return type right for SETOF  ("Dan Langille" <dan@langille.org>)
Responses Re: Getting the return type right for SETOF
List pgsql-sql
On Sat, 30 Aug 2003, Dan Langille wrote:

> Hi folks,
>
> I'm playing with SETOF on functions.  But I can't get the return type
> correct.  What have I missed?  A cast?
>
> CREATE OR REPLACE FUNCTION elementGet (text) RETURNS SETOF
> element_type AS '
>
> select 1,
>        \'test\',
>        \'F\'
>        \'A\',
>        FALSE,
>        FALSE
> '
>     LANGUAGE sql stable;
> ERROR:  function declared to return element_type returns "unknown"
> instead of text at column 2

I think you'll need to explicitly make the three text columns text rather
than just a plain literal (so ''test''::text for example)



pgsql-sql by date:

Previous
From: "Dan Langille"
Date:
Subject: Getting the return type right for SETOF
Next
From: Tom Lane
Date:
Subject: Re: BEFORE UPDATE Triggers