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:
@@ -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 $$
|
||||
|
||||
Reference in New Issue
Block a user