mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
PL/Python: Improve test coverage
Add test cases for inline handler of plython2u (when using that language name), and for result object element assignment. There is now at least one test case for every top-level functionality, except plpy.Fatal (annoying to use in regression tests) and result object slice retrieval and slice assignment (which are somewhat broken).
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
DO $$ plpy.notice("This is plpythonu.") $$ LANGUAGE plpythonu;
|
||||
|
||||
DO $$ plpy.notice("This is plpython2u.") $$ LANGUAGE plpython2u;
|
||||
|
||||
DO $$ nonsense $$ LANGUAGE plpythonu;
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
--
|
||||
-- result objects
|
||||
--
|
||||
|
||||
CREATE FUNCTION test_resultobject_access() RETURNS void
|
||||
AS $$
|
||||
rv = plpy.execute("SELECT fname, lname, username FROM users ORDER BY username")
|
||||
plpy.info([row for row in rv])
|
||||
rv[1] = dict([(k, v*2) for (k, v) in rv[1].items()])
|
||||
plpy.info([row for row in rv])
|
||||
$$ LANGUAGE plpythonu;
|
||||
|
||||
SELECT test_resultobject_access();
|
||||
|
||||
|
||||
--
|
||||
-- nested calls
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user