Re: About Types

From: mmiranda(at)americatel(dot)com(dot)sv
To: typo3(at)self-access(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: About Types
Date: 2005-05-12 18:42:24
Message-ID: 76E0DAA32C39D711B6EC0002B364A6FA04544445@amsal01exc01.americatel.com.sv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pgsql-general-owner(at)postgresql(dot)org wrote:
> Hi everybody,
>
> I'm a PG newbie, and I'm trying to write a function that returns a
> set of records.
> These records come from 2 or more tables (joined).
>
> When I have only 1 table, the return type of the function can be SETOF
> mytable.
> When I have 2 tables or more, am I obliged to create a type (CREATE
> TYPE) so that my function can return a SETOF mytype?
>
> This works fine, but I'm trying to avoid building a specific type for
> each row returning function.
> Is there any other solution (SQL or PLPGSQL)?

Yes, return setof record, look at this site, it helped me a lot.

http://techdocs.postgresql.org/guides/SetReturningFunctions

---
Miguel

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-05-12 18:56:35 Re: pg_dump: ERROR: Memory exhausted in AllocSetAlloc(875574064)
Previous Message Hervé Inisan 2005-05-12 18:31:16 About Types