With the current SRF patch, in certain circumstances selecting from a
VIEW produces "Buffer Leak" warnings, while selecting from the function
itself does not. Also the VIEW returns only one of the two expected
rows. The same SQL function when declared as "... getfoo(int) RETURNS
int AS ..." instead of "... getfoo(int) RETURNS *setof* int AS..." does
not produce the warning. Any ideas what I should be focusing on to track
this down? Does anyone have any favorite troubleshooting techniques for
this type of problem?
Thanks,
Joe
-- sql, proretset = t, prorettype = b
DROP FUNCTION getfoo(int);
DROP
CREATE FUNCTION getfoo(int) RETURNS setof int AS 'SELECT fooid FROM foo
WHERE fooid = $1;' LANGUAGE SQL;
CREATE
SELECT * FROM getfoo(1) AS t1; getfoo
-------- 1 1
(2 rows)
DROP VIEW vw_getfoo;
DROP
CREATE VIEW vw_getfoo AS SELECT * FROM getfoo(1);
CREATE
SELECT * FROM vw_getfoo;
psql:../srf-test.sql:21: WARNING: Buffer Leak: [055] (freeNext=-3,
freePrev=-3, rel=16570/123204, blockNum=1, flags=0x4, refcount=1 1)
psql:../srf-test.sql:21: WARNING: Buffer Leak: [059] (freeNext=-3,
freePrev=-3, rel=16570/123199, blockNum=0, flags=0x85, refcount=1 1) getfoo
-------- 1
(1 row)