The versions of PostgreSQL I used:
* CVS of Dec. 11, virgin installation without any further changes
* 7.1.3
I have simple SQL functions `testfun()' and `testfun1()' returning values
of the type of relation `T':
=>CREATE TABLE T ( id int8, name text );
=>insert into T VALUES ( 15, 'my name' );
=>CREATE FUNCTION testfun() RETURNS T AS '
'>SELECT 13::int8 as id, ''your name''::text as name;' LANGUAGE sql;
-- or: 'sql' for PostgreSQL 7.1.3
=>CREATE FUNCTION testfun1() RETURNS T AS '
'>SELECT id, name from T;' LANGUAGE sql;
-- or: 'sql' for PostgreSQL 7.1.3
Now I try to call the first function and return the values to the user:
=>select name(r.a) from (select testfun() as a) as r;
ERROR: fmgr_info: function 137857576: cache lookup failed
Does not work. For the second function I first try a simpler call:
=> select r.a from (select testfun1() as a) as r;
a
-----------
137835800
(1 Zeile)
Works but does not help. Retrying it gives two alternating return values:
=> select r.a from (select testfun1() as a) as r;
a
-----------
137857448
(1 Zeile)
=> select r.a from (select testfun1() as a) as r;
a
-----------
137835800
(1 Zeile)
=> select r.a from (select testfun1() as a) as r;
a
-----------
137857448
(1 Zeile)
Now lets look if can return the result of the second function to the
user:
=>select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137835928: cache lookup failed
=> select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137857576: cache lookup failed
=>select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137835928: cache lookup failed
=> select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137857576: cache lookup failed
=>select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137835928: cache lookup failed
=> select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137857576: cache lookup failed
=>select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137835928: cache lookup failed
=> select name(r.a) from (select testfun1() as a) as r;
ERROR: fmgr_info: function 137857576: cache lookup failed
Unfortunately I cannot.
Is this a sign of insufficient experience from my side or a real bug ?
--
Holger Krug
hkrug@rationalizer.com