Re: Getting the return type right for SETOF

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Dan Langille <dan(at)langille(dot)org>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Getting the return type right for SETOF
Date: 2003-08-30 20:59:40
Message-ID: 20030830135853.I74114-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2003-08-30 21:56:27 Re: BEFORE UPDATE Triggers
Previous Message Dan Langille 2003-08-30 20:42:23 Getting the return type right for SETOF