From what I tried it is possible to create such a function but it is not possible to call it ?! Can anyone provide an example?
create table foo (f1 int, f2 text);
insert into foo values(1,'a'); insert into foo values(2,'b'); insert into foo values(3,'c');
create or replace function get_foo(int) returns foo as 'select * from foo where f1 = $1' language 'sql';
create or replace function use_foo(foo) returns text as ' declare v_foo alias for $1; begin return v_foo.f2; end; ' language 'plpgsql';
regression=# select use_foo(get_foo(2)); use_foo --------- b (1 row)
HTH,
Joe
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster