1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

PL/Python: Add result object str handler

This is intended so that say plpy.debug(rv) prints something useful for
debugging query execution results.

reviewed by Steve Singer
This commit is contained in:
Peter Eisentraut
2013-02-03 00:31:01 -05:00
parent d2d153fdb0
commit 330ed4ac6c
4 changed files with 61 additions and 1 deletions

View File

@@ -169,6 +169,16 @@ $$ LANGUAGE plpythonu;
SELECT result_empty_test();
CREATE FUNCTION result_str_test(cmd text) RETURNS text
AS $$
plan = plpy.prepare(cmd)
result = plpy.execute(plan)
return str(result)
$$ LANGUAGE plpythonu;
SELECT result_str_test($$SELECT 1 AS foo, '11'::text AS bar UNION SELECT 2, '22'$$);
SELECT result_str_test($$CREATE TEMPORARY TABLE foo1 (a int, b text)$$);
-- cursor objects
CREATE FUNCTION simple_cursor_test() RETURNS int AS $$