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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-sql by date

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