problem with composed types in plpgsql

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема problem with composed types in plpgsql
Дата
Msg-id Pine.LNX.4.44.0210071111060.1223-100000@kix.fsv.cvut.cz
обсуждение исходный текст
Ответы Returning composite types from functions
Список pgsql-general
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.



В списке pgsql-general по дате отправления:

Предыдущее
От: Hans-Jürgen Schönig
Дата:
Сообщение: Re: [pgsql-performance] Large databases, performance
Следующее
От: Karel Zak
Дата:
Сообщение: Re: Server locale?