<Eugen(dot)Konkov(at)aldec(dot)com> writes:
> PG v8.3.1
> CREATE or REPLACE FUNCTION "public"."aaa"()
> RETURNS SETOF "pg_catalog"."record" AS
> $BODY$
> DECLARE r record;
> BEGIN
> select 1 as num into r; -- here PG know that first field is integer and has
> name 'num'
> return next r;
> return;
> END;
> $BODY$
> LANGUAGE 'plpgsql' VOLATILE;
> select * from aaa()
> Expected result:
> num
> --------
> 1
This is not a bug. The semantics of a query have to be determinable
without looking "inside" the bodies of functions it calls.
regards, tom lane