From 2cfb1c6f77734db81b6e74bcae630f93b94f69be Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Fri, 11 May 2012 23:01:15 +0300
Subject: 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.
---
 src/pl/plpython/sql/plpython_trigger.sql | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'src/pl/plpython/sql/plpython_trigger.sql')

diff --git a/src/pl/plpython/sql/plpython_trigger.sql b/src/pl/plpython/sql/plpython_trigger.sql
index f60565cde6..2a4859f2aa 100644
--- a/src/pl/plpython/sql/plpython_trigger.sql
+++ b/src/pl/plpython/sql/plpython_trigger.sql
@@ -75,8 +75,14 @@ if 'relid' in TD:
 skeys = list(TD.keys())
 skeys.sort()
 for key in skeys:
-	val = TD[key]
-	plpy.notice("TD[" + key + "] => " + str(val))
+    val = TD[key]
+    if not isinstance(val, dict):
+        plpy.notice("TD[" + key + "] => " + str(val))
+    else:
+        # print dicts the hard way because otherwise the order is implementation-dependent
+        valkeys = list(val.keys())
+        valkeys.sort()
+        plpy.notice("TD[" + key + "] => " + '{' + ', '.join([repr(k) + ': ' + repr(val[k]) for k in valkeys]) + '}')
 
 return None
 
-- 
cgit v1.2.1

