From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Mungall <cjm@fruitfly.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Calling SQL functions that return sets
Date: Mon, 01 Aug 2005 21:48:12 -0400
Message-ID: <14685.1122947292@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.OSX.4.58.0508011724380.14023@skerryvore.dhcp.lbl.gov>
References: <Pine.OSX.4.58.0508011438210.14023@skerryvore.dhcp.lbl.gov>
<26174.1122940637@sss.pgh.pa.us>
<Pine.OSX.4.58.0508011724380.14023@skerryvore.dhcp.lbl.gov>
Chris Mungall <cjm@fruitfly.org> writes:
> On Mon, 1 Aug 2005, Tom Lane wrote:
>> Chris Mungall <cjm@fruitfly.org> writes:
>>> What are the reasons for deprecating the use of the function in the
>>> SELECT clause?
>>
>> The semantics of having more than one set-returning function in the
>> target list are, um, poorly thought out. However, we haven't removed
>> the feature because (as you note) there are things you can't do any
>> other way.
> Is there any roadmap for how this will be handled in future versions?
I think it's reasonably safe to say that we won't remove the feature for
at least one or two releases after having a 100% substitute (which the
present SRF-in-FROM feature is not, as you know). There has been some
speculation that the SQL:2003 LATERAL syntax might offer an adequate
substitute, but no one is really working on that yet AFAIK.
> Coming back to earth, I have a more specific question which follows on
> from my initial question. If I have a function 'foo' which takes one
> argument and returns a setof some table or composite type, it seems I am
> unable to call the function from the select clause.
> SELECT foo(1,2);
> ERROR: set-valued function called in context that cannot accept a set
The present plpgsql implementation only works for SRF-in-FROM. (Which
is something that could probably be fixed, but given the development
direction we want to go in, it doesn't seem like a very good use of
time...) You can do SRF-in-target-list with SQL-language functions or
C-coded functions; I'm not certain offhand about the status of the
other PL languages.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, cjm@fruitfly.org
Subject: Re: Calling SQL functions that return sets
In-Reply-To: <14685.1122947292@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox