Re: Polymorphic "setof record" function?

From: Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com>
To: General PostgreSQL List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Polymorphic "setof record" function?
Date: 2009-01-13 15:39:59
Message-ID: f205bb120901130739y679b8aabt96f5690f1a3b394e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2009/1/13 Christian Schröder <cs(at)deriva(dot)de>:
> Hi list,
> I have written a function that returns a setof record. The function has a
> table name as a parameter and the resulting records have the same structure
> as this table. Is there any easy way to specify this when I call the
> function? If the table has many columns then it's annoying to specify all of
> them.
> I need something like:
> select * from myfunc('mytable') as x(like mytable)
> or
> select * from myfunc('mytable') as x(mytable%TYPE)
>
> Is there any solution for PostgreSQL 8.2?
>

Can make the function with text parametter (table name) and
search in the catalog for the table?. Then you will have the table
to get %TYPE...

> Regards,
> Christian
>
> --
> Deriva GmbH Tel.: +49 551 489500-42
> Financial IT and Consulting Fax: +49 551 489500-91
> Hans-Böckler-Straße 2 http://www.deriva.de
> D-37079 Göttingen
>
> Deriva CA Certificate: http://www.deriva.de/deriva-ca.cer
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
Emanuel Calvo Franco
ArPUG / AOSUG Member
Postgresql Support & Admin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-01-13 16:22:05 Re: Polymorphic "setof record" function?
Previous Message Nykolyn, Andrew 2009-01-13 15:23:39 Cast for text->Integer missing in 8.3.5