Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi again

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

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!


In response to


pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group