diff options
Diffstat (limited to 'src/pl/plpython/sql/plpython_setof.sql')
-rw-r--r-- | src/pl/plpython/sql/plpython_setof.sql | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/pl/plpython/sql/plpython_setof.sql b/src/pl/plpython/sql/plpython_setof.sql index 80a8d5b4c1e..243f711dcc6 100644 --- a/src/pl/plpython/sql/plpython_setof.sql +++ b/src/pl/plpython/sql/plpython_setof.sql @@ -62,3 +62,15 @@ SELECT test_setof_as_iterator(2, 'list'); SELECT test_setof_as_iterator(2, null); SELECT test_setof_spi_in_iterator(); + + +-- setof function with an SPI result set (used to crash because of +-- memory management issues across multiple calls) + +CREATE OR REPLACE FUNCTION get_user_records() +RETURNS SETOF users +AS $$ + return plpy.execute("SELECT * FROM users ORDER BY username") +$$ LANGUAGE plpythonu; + +SELECT get_user_records(); |