From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Joe Conway <mail(at)joeconway(dot)com> |
Cc: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [Fwd: SETOF input parameters (was Re: [HACKERS] proposal: array utility functions phase 1)] |
Date: | 2002-12-19 01:07:52 |
Message-ID: | 13770.1040260072@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Joe Conway <mail(at)joeconway(dot)com> writes:
>> create or replace function test2() returns setof foot as 'select * from
>> foot order by 1 asc' language 'sql';
>> create or replace function test(setof foot) returns foot as 'select
>> $1.f1, $1.f2' language 'sql';
Uh, where exactly are you storing the information that the function
accepts a setof argument?
(We probably should be rejecting the above syntax at the moment, but
I suspect the parser just fails to notice the setof marker.)
A more serious objection is that this doesn't really address the
fundamental issue, namely that you can't drive a SRF from the results of
a query, except indirectly via single-purpose function definitions (like
test2() in your example).
I'm leaning more and more to the thought that we should reconsider the
Berkeley approach.
Another line of thought is to consider the possibilities of subselects
in the target list. For example,
SELECT ..., (SELECT ... FROM mysrf(a, b)) FROM foo WHERE ...;
I believe it's already the case that foo.a and foo.b can be transmitted
as arguments to mysrf() with this notation. The restriction is that the
sub-select can only return a single value (one row, one column) to the
outer query. It doesn't seem too outlandish to allow multiple columns
to be pulled up into the outer SELECT's result list given the above
syntax. I'm less sure about allowing multiple rows though. Any
thoughts?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Gavin Sherry | 2002-12-19 01:24:00 | Re: user defined settings (aka user defined guc variables) |
Previous Message | Joe Conway | 2002-12-19 01:00:19 | user defined settings (aka user defined guc variables) |
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2002-12-19 02:53:42 | Re: [Fwd: SETOF input parameters (was Re: [HACKERS] proposal: |
Previous Message | Joe Conway | 2002-12-19 00:20:31 | [Fwd: SETOF input parameters (was Re: [HACKERS] proposal: array utility functions phase 1)] |