From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | alla(at)sergey(dot)com (Alla) |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: What's wrong with this function - "returns setof" |
Date: | 2002-02-01 20:36:52 |
Message-ID: | 12631.1012595812@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
alla(at)sergey(dot)com (Alla) writes:
> select get_field1(results.a), get_field2(results.b)
> from (select test_func('aaa') as p) as resutls;
> I am getting the following error:
> ERROR: No such attribute or function 'get_field1'
Well, correct syntax would be
select get_field1(results.p), get_field2(results.p)
from (select test_func('aaa') as p) as results;
but unfortunately that still isn't gonna work. The code supporting
functions returning sets is fairly disheveled at the moment, having
suffered a lot of bit-rot and no attention since Berkeley days; and
even back then there seems to have been some fatal confusion between
true functions and "set attribute" functions. Here the parser is
mistaking results.p for a "set attribute", which it ain't.
We are talking about resurrecting the capability in a more
straightforward form, wherein you'd write just
select field1, field2 from test_func('foo') as results;
ie, the result of a function returning setof would be treated
syntactically as a table in its own right; but it's not happening
quite yet.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-02-01 20:39:52 | Re: pg_vlock / vacuum |
Previous Message | Stephan Szabo | 2002-02-01 20:36:10 | Re: Again about foreign keys and inheritance |