Re: function returning a row

From: Kjetil Haaland <kjetil(dot)haaland(at)student(dot)uib(dot)no>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: function returning a row
Date: 2004-12-15 14:03:18
Message-ID: 200412151503.18617.kjetil.haaland@student.uib.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi again

I know that this is an old question but I have some more that i am wondering
about.

On Thursday 18 November 2004 17:19, Michael Fuhr wrote:
> > If i try to let the function use a type that is only created in postgres
> > (not c code) then it works.
>
> I assume you mean it works for a composite type like this:
>
> CREATE TYPE foo AS (val INTEGER, fstring TEXT);
>
yes thats correct. This works fine while i am following the documentation.

> As the CREATE TYPE documentation says, this is essentially the same
> as the row type of a table. But your type is a scalar, not a composite,
> so RelationNameGetTupleDesc() doesn't work.
>
> > Is it possible to use my own type to be returned?
>
> Yes, and you've already written a function that does: alignres_in().
> Its CREATE FUNCTION statement says "RETURNS alignres", doesn't it?
> If you want the new function to return a single value of your type,
> then do what alignres_in() does.

this i have done, i can return a single value of my own type from the
function. So now i am wondering, is it possible to return a set of my type?
If it is possible, how do i do that?

thanks for all the help so far!

-Kjetil

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message sarlav kumar 2004-12-15 14:38:22 \d output to a file
Previous Message Geoffrey 2004-12-15 12:39:54 Re: postgresql compile errors