Re: function returning a row - Mailing list pgsql-novice

From Kjetil Haaland
Subject Re: function returning a row
Date
Msg-id 200412151503.18617.kjetil.haaland@student.uib.no
Whole thread Raw
In response to Re: function returning a row  (Michael Fuhr <mike@fuhr.org>)
Responses Re: function returning a row  (Joe Conway <mail@joeconway.com>)
List 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

pgsql-novice by date:

Previous
From: Geoffrey
Date:
Subject: Re: postgresql compile errors
Next
From: sarlav kumar
Date:
Subject: \d output to a file