From ff7d51361044330d98188527eb9d7b1a10b5e1c3 Mon Sep 17 00:00:00 2001
From: Catalin Iacob <iacobcatalin@gmail.com>
Date: Mon, 29 Feb 2016 07:20:11 +0100
Subject: [PATCH 2/5] Fix tests for Python 2.4

format doesn't exist so use % formatting and use the old except syntax
regress-python3-mangle.mk automatically transforms these into
Exception as e for Python3
---
 src/pl/plpython/expected/plpython_test.out | 6 +++---
 src/pl/plpython/sql/plpython_test.sql      | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/pl/plpython/expected/plpython_test.out b/src/pl/plpython/expected/plpython_test.out
index 4817022..8a55ee2 100644
--- a/src/pl/plpython/expected/plpython_test.out
+++ b/src/pl/plpython/expected/plpython_test.out
@@ -236,7 +236,7 @@ DETAIL:  message:(plpy.Error: message text), detail:(detail text), hint: (hint t
 do $$
 try:
 	plpy.execute("select raise_exception(_message => 'my message', _sqlstate => 'XX987', _hint => 'some hint', _table=> 'users_tab', _datatype => 'user_type')")
-except Exception as e:
+except Exception, e:
 	plpy.info(e.spidata)
 	raise e
 $$ LANGUAGE plpythonu;
@@ -246,8 +246,8 @@ HINT:  some hint
 do $$
 try:
   plpy.error(message  = 'my message', sqlstate = 'XX987', hint = 'some hint', table = 'users_tab', datatype = 'user_type')
-except Exception as e:
-  plpy.info('sqlstate: {0}, hint: {1}, tablename: {2}, datatype: {3}'.format(e.sqlstate, e.hint, e.table_name, e.datatype_name))
+except Exception, e:
+  plpy.info('sqlstate: %s, hint: %s, tablename: %s, datatype: %s' % (e.sqlstate, e.hint, e.table_name, e.datatype_name))
   raise e
 $$ LANGUAGE plpythonu;
 INFO:  sqlstate: XX987, hint: some hint, tablename: users_tab, datatype: user_type
diff --git a/src/pl/plpython/sql/plpython_test.sql b/src/pl/plpython/sql/plpython_test.sql
index 5b39330..9bbeb34 100644
--- a/src/pl/plpython/sql/plpython_test.sql
+++ b/src/pl/plpython/sql/plpython_test.sql
@@ -170,7 +170,7 @@ $$;
 do $$
 try:
 	plpy.execute("select raise_exception(_message => 'my message', _sqlstate => 'XX987', _hint => 'some hint', _table=> 'users_tab', _datatype => 'user_type')")
-except Exception as e:
+except Exception, e:
 	plpy.info(e.spidata)
 	raise e
 $$ LANGUAGE plpythonu;
@@ -178,7 +178,7 @@ $$ LANGUAGE plpythonu;
 do $$
 try:
   plpy.error(message  = 'my message', sqlstate = 'XX987', hint = 'some hint', table = 'users_tab', datatype = 'user_type')
-except Exception as e:
-  plpy.info('sqlstate: {0}, hint: {1}, tablename: {2}, datatype: {3}'.format(e.sqlstate, e.hint, e.table_name, e.datatype_name))
+except Exception, e:
+  plpy.info('sqlstate: %s, hint: %s, tablename: %s, datatype: %s' % (e.sqlstate, e.hint, e.table_name, e.datatype_name))
   raise e
 $$ LANGUAGE plpythonu;
-- 
2.7.1

