Re: SQL: table function support

"Pavel Stehule" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.patches
Message-ID <[email protected]>
2008/6/10 Neil Conway <[email protected]>:
> On Tue, 2008-06-10 at 06:42 +0200, Pavel Stehule wrote:
>> internally is table functions implemenation identical with SRF.
>
> It's not the internals that I'm concerned about.
>
>> Semantically is far - user's doesn't specify return type (what is from
>> PostgreSQL), but specifies return table, what is more natural. What
>> more - for users is transparent chaotic joice betwen "SETOF RECORD"
>> for multicolumns sets and "SETOF type".
>
> Well, I'd just like to see some thought about how this *entire* feature
> ought to work, rather than just adding new knobs and syntax variants
> incrementally and seemingly at random. Just because it happens to be in
> the standard isn't really a compelling reason to make an overly-complex
> part of the system even more complicated, IMHO...
>
> -Neil
>

This feature has only little sense with plpgsql, but together with
sql's functions allows more readable code. And is significant for
SQL/PSM.

what is more logical and consistent?

create or replace function fx(a integer, out b integer, out c integer)
returns setof record as $$
select a, b
  from foo
 where a = $1;
$$ language sql;

or

create or replace function fx(a integer)
returns table(b integer, c integer) as $$
select a, b
  from foo
 where a = $1;
$$ language sql;


Pavel

>
>

-- 
Sent via pgsql-patches mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.