Skip site navigation (1) Skip section navigation (2)

problem with composed types in plpgsql

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: pgsql-bugs(at)postgresql(dot)org
Subject: problem with composed types in plpgsql
Date: 2002-10-07 09:22:31
Message-ID: Pine.LNX.4.44.0210071122090.1223-100000@kix.fsv.cvut.cz (view raw or flat)
Thread:
Lists: pgsql-bugs
Hello

I play with new beta version (7.3b2). I trayed compose types created with 
create type.

CREATE TYPE tf AS (f1 varchar(10), f2 varchar(10));

I wanted this type as returned type from plpgsql function. But I didn't 
find how use this type in plpgsql. When I have function

CREATE OR REPLACE FUNCTION makesettf(integer) RETURNS SETOF tf AS '
  DECLARE f tf;
  BEGIN
    FOR i IN 1..$1 LOOP
      f.f1 := ''aaaaa'';
      f.f2 := ''bbbbb'';
      RETURN NEXT f;
    END LOOP;
    RETURN;
  END;
' LANGUAGE 'plpgsql';

After SELECT * FROM makesettf(10) I got message 

psql:testfc.sql:17: WARNING:  plpgsql: ERROR during compile of makesettf 
near line 6
psql:testfc.sql:17: ERROR:  Incorrect argument to RETURN NEXT at or near 
"f".

Can I use in this version compose types?
Thank you
Pavel

PS. I can't use compose type in raise parameter too.




Responses

pgsql-bugs by date

Next:From: Masaru SugawaraDate: 2002-10-07 12:04:59
Subject: Re: problem with composed types in plpgsql
Previous:From: Szymon JuraszczykDate: 2002-10-07 03:40:18
Subject: Query optimizer bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group