diff options
| author | Peter Eisentraut <peter_e@gmx.net> | 2012-05-02 21:09:03 +0300 |
|---|---|---|
| committer | Peter Eisentraut <peter_e@gmx.net> | 2012-05-02 21:09:03 +0300 |
| commit | e6c2e8cb87846161033e1f215876c4b95f631df0 (patch) | |
| tree | a78adc0f42d9ab816fa7d034db4ba48c83ba92ec /src/pl/plpython/sql/plpython_spi.sql | |
| parent | 52aa334fcd5a9d230be7e8fb964d94c6c4e63dc7 (diff) | |
| download | postgresql-e6c2e8cb87846161033e1f215876c4b95f631df0.tar.gz | |
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).
Diffstat (limited to 'src/pl/plpython/sql/plpython_spi.sql')
| -rw-r--r-- | src/pl/plpython/sql/plpython_spi.sql | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pl/plpython/sql/plpython_spi.sql b/src/pl/plpython/sql/plpython_spi.sql index ce218e93b6..7be2fbff71 100644 --- a/src/pl/plpython/sql/plpython_spi.sql +++ b/src/pl/plpython/sql/plpython_spi.sql @@ -1,4 +1,19 @@ -- +-- 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 -- |
