Re: SETOF (was: Function example returning more then 1

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Kolus Maximiliano <Kolus(dot)maximiliano(at)bcr(dot)com(dot)ar>
Cc: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: SETOF (was: Function example returning more then 1
Date: 2003-02-27 16:28:13
Message-ID: 20030227082228.P86039-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 27 Feb 2003, Kolus Maximiliano wrote:

> > You can't return more than one return value from function, but that
> > value can be of composite type.For example :"setof text" or "setof record"
> > are such types.
>
> Can you use functions returning "setof"s as if they were "normal"
> selects?.
>
> I saw that setof takes a type or table as an argument. What if what
> i want to return is not in a table schema, can i do something like "setof
> (blah inet, blah2 varchar(256))"?

You might want to read the Set Returning Functions document on techdocs:
http://techdocs.postgresql.org/guides/SetReturningFunctions

The best answer is to define a row type for it with CREATE TYPE, but you
can also return setof record and rely on the user putting the type
information in the select.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-02-27 16:28:48 Re: index usage (and foreign keys/triggers)
Previous Message scott.marlowe 2003-02-27 16:22:57 Re: 7.4?