Re: Redundant explicit field name/types description while select from function with return type of record

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eugen(dot)Konkov(at)aldec(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Redundant explicit field name/types description while select from function with return type of record
Date: 2008-03-28 14:55:30
Message-ID: 3663.1206716130@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

<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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-03-28 14:58:05 Re: FOR-IN-EXECUTE: FOR does not replanned on each entry to the FOR loop
Previous Message Tom Lane 2008-03-28 14:48:53 Re: BUG: wrong doc or wrong connectby?