Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group