summaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql/plpython_params.sql
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2012-05-11 23:01:15 +0300
committerPeter Eisentraut <peter_e@gmx.net>2012-05-11 23:04:47 +0300
commit2cfb1c6f77734db81b6e74bcae630f93b94f69be (patch)
tree57db3ab48931ffe5a906998f2418a1d9f5b3ab48 /src/pl/plpython/sql/plpython_params.sql
parent63fecc91770f3d494b6fe993bdc198a9faf6fe2d (diff)
downloadpostgresql-2cfb1c6f77734db81b6e74bcae630f93b94f69be.tar.gz
PL/Python: Adjust the regression tests for Python 3.3
The string representation of ImportError changed. Remove printing that; it's not necessary for the test. The order in which members of a dict are printed changed. But this was always implementation-dependent, so we have just been lucky for a long time. Do the printing the hard way to ensure sorted order.
Diffstat (limited to 'src/pl/plpython/sql/plpython_params.sql')
-rw-r--r--src/pl/plpython/sql/plpython_params.sql9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pl/plpython/sql/plpython_params.sql b/src/pl/plpython/sql/plpython_params.sql
index d97e0b8549..f580abe53d 100644
--- a/src/pl/plpython/sql/plpython_params.sql
+++ b/src/pl/plpython/sql/plpython_params.sql
@@ -14,7 +14,14 @@ $$ LANGUAGE plpythonu;
CREATE FUNCTION test_param_names2(u users) RETURNS text AS $$
assert u == args[0]
-return str(u)
+if isinstance(u, dict):
+ # stringify dict the hard way because otherwise the order is implementation-dependent
+ u_keys = list(u.keys())
+ u_keys.sort()
+ s = '{' + ', '.join([repr(k) + ': ' + repr(u[k]) for k in u_keys]) + '}'
+else:
+ s = str(u)
+return s
$$ LANGUAGE plpythonu;
-- use deliberately wrong parameter names