mirror of
https://github.com/postgres/postgres.git
synced 2026-01-13 12:22:55 +03:00
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.
This commit is contained in:
@@ -45,7 +45,7 @@ CONTEXT: PL/Python function "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 ])
|
||||
@@ -64,7 +64,7 @@ CONTEXT: PL/Python function "invalid_type_uncaught"
|
||||
*/
|
||||
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" ])
|
||||
@@ -87,7 +87,7 @@ CONTEXT: PL/Python function "invalid_type_caught"
|
||||
*/
|
||||
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" ])
|
||||
@@ -108,7 +108,7 @@ CONTEXT: PL/Python function "invalid_type_reraised"
|
||||
*/
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user