alla@sergey.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