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

From Dan Langille
Subject Getting the return type right for SETOF
Date
Msg-id 3F50D3EF.27516.2FEF6552@localhost
Whole thread Raw
Responses Re: Getting the return type right for SETOF  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-sql
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

\d element_type
Composite type "public.element_type"  Column   |  Type
------------+---------id         | integername       | texttype       | textstatus     | textiscategory | booleanisport
   | boolean
 



-- 
Dan Langille : http://www.langille.org/



pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re: BEFORE UPDATE Triggers
Next
From: Stephan Szabo
Date:
Subject: Re: Getting the return type right for SETOF