Caught exceptions in PL/pgSQL appear to leak memory -- is that
expected?  Here's a contrived test case:

CREATE FUNCTION foo(n integer) RETURNS void AS $$
BEGIN
    FOR i IN 1 .. n LOOP
        BEGIN
            RAISE EXCEPTION 'test';
        EXCEPTION
          WHEN OTHERS THEN
            NULL;
        END;
    END LOOP;
END;
$$ LANGUAGE plpgsql VOLATILE STRICT;

SELECT foo(200000);

If you watch the backend with top you should see the process size
grow by around 500-600 (512?) bytes per exception caught (you might
need to use more iterations on a fast system to see the effect).

-- 
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to