From 5dff93638c4443d3afba017f64c9ade69e0fbd3b Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Mon, 24 Aug 2009 20:25:25 +0000
Subject: Make PL/Python tests more compatible with Python 3

This changes a bunch of incidentially used constructs in the PL/Python
regression tests to equivalent constructs in cases where Python 3 no longer
supports the old syntax.  Support for older Python versions is unchanged.
---
 src/pl/plpython/sql/plpython_error.sql | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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

diff --git a/src/pl/plpython/sql/plpython_error.sql b/src/pl/plpython/sql/plpython_error.sql
index 04161bc25e..5ca68495be 100644
--- a/src/pl/plpython/sql/plpython_error.sql
+++ b/src/pl/plpython/sql/plpython_error.sql
@@ -37,7 +37,7 @@ SELECT exception_index_invalid_nested();
  */
 CREATE FUNCTION invalid_type_uncaught(a text) RETURNS text
 	AS
-'if not SD.has_key("plan"):
+'if "plan" not in SD:
 	q = "SELECT fname FROM users WHERE lname = $1"
 	SD["plan"] = plpy.prepare(q, [ "test" ])
 rv = plpy.execute(SD["plan"], [ a ])
@@ -55,7 +55,7 @@ SELECT invalid_type_uncaught('rick');
  */
 CREATE FUNCTION invalid_type_caught(a text) RETURNS text
 	AS
-'if not SD.has_key("plan"):
+'if "plan" not in SD:
 	q = "SELECT fname FROM users WHERE lname = $1"
 	try:
 		SD["plan"] = plpy.prepare(q, [ "test" ])
@@ -77,7 +77,7 @@ SELECT invalid_type_caught('rick');
  */
 CREATE FUNCTION invalid_type_reraised(a text) RETURNS text
 	AS
-'if not SD.has_key("plan"):
+'if "plan" not in SD:
 	q = "SELECT fname FROM users WHERE lname = $1"
 	try:
 		SD["plan"] = plpy.prepare(q, [ "test" ])
@@ -97,7 +97,7 @@ SELECT invalid_type_reraised('rick');
  */
 CREATE FUNCTION valid_type(a text) RETURNS text
 	AS
-'if not SD.has_key("plan"):
+'if "plan" not in SD:
 	SD["plan"] = plpy.prepare("SELECT fname FROM users WHERE lname = $1", [ "text" ])
 rv = plpy.execute(SD["plan"], [ a ])
 if len(rv):
-- 
cgit v1.2.1

