pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Dan Langille <dan@langille.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Getting the return type right for SETOF
Date: Sat, 30 Aug 2003 13:59:40 -0700 (PDT)
Message-ID: <20030830135853.I74114-100000@megazone.bigpanda.com> (raw)
In-Reply-To: <3F50D3EF.27516.2FEF6552@localhost>

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)




view thread (3+ messages)  latest in thread

Message-ID: <20030830135853.I74114-100000@megazone.bigpanda.com>
Permalink:  ../20030830135853.I74114-100000@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20030830135853.I74114-100000@megazone.bigpanda.com

 · 

reply

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: sszabo@megazone.bigpanda.com, dan@langille.org
  Subject: Re: Getting the return type right for SETOF
  In-Reply-To: <20030830135853.I74114-100000@megazone.bigpanda.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