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 15:17:48
Message-ID: 20080603171748.596b8a4c@dawn.webthatworks.it (view raw or flat)
Thread:
Lists: pgsql-sql
On Tue, 3 Jun 2008 10:06:45 -0400
"maria s" <psmg01(at)gmail(dot)com> wrote:

> Hi Ivan,
> If I have to know the column names then I can't use the Functions.
> As I said before, the columns will vary. or As Pavel Stehule said
> I will use arrays.
> 
> Is anyone can show an example of returning a record with string
> and array?

What I meant was that with "pure" sql functions you shouldn't have
that constraint...

wrapping a select in a function

create or replace function fsql() as
$$
begin
  select * from mytable;
end;
$$ language sql;

should work.

SQL functions are less flexible than pg/plsql but maybe you can live
with it.
SQL functions still support conditionals etc... you'd have to see if
what SQL functions offer is enough for your need.

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


In response to

pgsql-sql by date

Next:From: Pavel StehuleDate: 2008-06-03 16:14:44
Subject: Re: function returning result set of varying column
Previous:From: maria sDate: 2008-06-03 15:06:02
Subject: Re: function returning result set of varying column

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