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

Re: function returning result set of varying column

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: function returning result set of varying column
Date: 2008-06-03 13:57:45
Message-ID: 20080603155745.15e6cb70@dawn.webthatworks.it (view raw or flat)
Thread:
Lists: pgsql-sql
On Tue, 3 Jun 2008 09:41:27 -0400
"maria s" <psmg01(at)gmail(dot)com> wrote:

> Thanks for all your replies.
> 
> Actually I don't know the number of columns that I am going to
> return.
> 
> I have 2 tables. For a single entry E1  in one table(t1), I have
> to fetch all the matching entries for E1 from the other
> table(t2),  K1,..Kn. and finally the function should return E1,
> K1..Kn. So I don't know the number of columns that I am going to
> get.
> 
> Is it possible to write a function that returns this kind of
> result?

Up to my knowledge as Bart wrote in pl/pgsql you'll have to specify
somewhere the return type: in the function or in the select calling
the function.
If you use sql (not pl/pgsql) function you shouldn't be obliged to
specify the return type.
But I haven't written enough sql function to actually remember how
it works.

If you post your tentative sql it could give us more clue.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it


In response to

Responses

pgsql-sql by date

Next:From: Paul DamDate: 2008-06-03 14:02:51
Subject: Re: cross-database references are not implemented
Previous:From: Adrian KlaverDate: 2008-06-03 13:57:17
Subject: Re: cross-database references are not implemented

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