Hi, I'm having a problem with plpgsql functions leaking memory. I've reproduced the problem with this simple function here : CREATE OR REPLACE FUNCTION ftest() RETURNS boolean AS $BODY$BEGIN INSERT INTO test2 values (1); RETURN true; END;$BODY$ LANGUAGE 'plpgsql' VOLATILE; test2 table is a one column table CREATE TABLE test2 ( id integer ) WITH (OIDS=FALSE); Then to see the leak, I've called it repeatedly with a perl program : #!/usr/bin/perl -w # # use DBI; $dbh = DBI->connect("dbi:Pg:dbname=test","postgres"); my $statement = 'SELECT ftest ()'; $sth = $dbh->prepare($statement); $dbh->begin_work(); for ($i=0;$i<1000000;$i++) { $sth->execute(); } $dbh->rollback(); I see the postgresql process growing from 8MB to about 400 MB during this run... It only seems to happen when a function contains an insert statement (I don't see leaks when only selecting). logs=# SELECT version(); version ------------------------------------------------------------------------------------ PostgreSQL 8.3.3 on x86_64-pc-linux-gnu, compiled by GCC cc (Debian 4.3.1-1) 4.3.1 (1 row)