Re: Redundant explicit field name/types description while select from function with return type of record - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Redundant explicit field name/types description while select from function with return type of record
Date
Msg-id 3663.1206716130@sss.pgh.pa.us
Whole thread Raw
In response to Redundant explicit field name/types description while select from function with return type of record  (<Eugen.Konkov@aldec.com>)
List pgsql-bugs
<Eugen.Konkov@aldec.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG: wrong doc or wrong connectby?
Next
From: Tom Lane
Date:
Subject: Re: FOR-IN-EXECUTE: FOR does not replanned on each entry to the FOR loop