Re: problem with composed types in plpgsql

From: Masaru Sugawara <rk73(at)sea(dot)plala(dot)or(dot)jp>
To: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: problem with composed types in plpgsql
Date: 2002-10-07 12:04:59
Message-ID: 20021007210428.2CEB.RK73@sea.plala.or.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, 7 Oct 2002 11:22:31 +0200 (CEST)
Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> wrote:

> 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;

DECLARE f tf%ROWTYPE;

Grant Finnemore showed me how to return a set of rows the week
before last.

http://archives.postgresql.org/pgsql-hackers/2002-09/msg01741.php

> 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.
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

Regards,
Masaru Sugawara

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-10-07 14:42:36 Re: Possible bug in PostgreSQL query planner
Previous Message Pavel Stehule 2002-10-07 09:22:31 problem with composed types in plpgsql