PL/pgSQL RETURN NEXT was leaking converted tuples, causing
authorJoe Conway <mail@joeconway.com>
Thu, 10 May 2012 05:51:17 +0000 (22:51 -0700)
committerJoe Conway <mail@joeconway.com>
Thu, 10 May 2012 05:51:17 +0000 (22:51 -0700)
out of memory when looping through large numbers of rows.
Flag the converted tuples to be freed. Complaint and patch
by Joe.

src/pl/plpgsql/src/pl_exec.c

index 2f8468336f8603cd20ee4137bf15f61327b143d9..0e77284d480528a5c1a3bf05b15bee1908dd8953 100644 (file)
@@ -2243,6 +2243,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate,
                    {
                        tuple = do_convert_tuple(tuple, tupmap);
                        free_conversion_map(tupmap);
+                       free_tuple = true;
                    }
                }
                break;