Re: function returning result set of varying column - Mailing list pgsql-sql

From Ivan Sergio Borgonovo
Subject Re: function returning result set of varying column
Date
Msg-id 20080603171748.596b8a4c@dawn.webthatworks.it
Whole thread Raw
In response to Re: function returning result set of varying column  ("maria s" <psmg01@gmail.com>)
List pgsql-sql
On Tue, 3 Jun 2008 10:06:45 -0400
"maria s" <psmg01@gmail.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



pgsql-sql by date:

Previous
From: "maria s"
Date:
Subject: Re: function returning result set of varying column
Next
From: "Pavel Stehule"
Date:
Subject: Re: function returning result set of varying column