aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql/plpython_subtransaction.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl/plpython/sql/plpython_subtransaction.sql')
-rw-r--r--src/pl/plpython/sql/plpython_subtransaction.sql37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/pl/plpython/sql/plpython_subtransaction.sql b/src/pl/plpython/sql/plpython_subtransaction.sql
index 398c65720ce..38c86178285 100644
--- a/src/pl/plpython/sql/plpython_subtransaction.sql
+++ b/src/pl/plpython/sql/plpython_subtransaction.sql
@@ -8,43 +8,6 @@ CREATE TABLE subtransaction_tbl (
i integer
);
--- Explicit case for Python <2.6
-
-CREATE FUNCTION subtransaction_test(what_error text = NULL) RETURNS text
-AS $$
-import sys
-subxact = plpy.subtransaction()
-subxact.__enter__()
-exc = True
-try:
- try:
- plpy.execute("INSERT INTO subtransaction_tbl VALUES (1)")
- plpy.execute("INSERT INTO subtransaction_tbl VALUES (2)")
- if what_error == "SPI":
- plpy.execute("INSERT INTO subtransaction_tbl VALUES ('oops')")
- elif what_error == "Python":
- raise Exception("Python exception")
- except:
- exc = False
- subxact.__exit__(*sys.exc_info())
- raise
-finally:
- if exc:
- subxact.__exit__(None, None, None)
-$$ LANGUAGE plpythonu;
-
-SELECT subtransaction_test();
-SELECT * FROM subtransaction_tbl;
-TRUNCATE subtransaction_tbl;
-SELECT subtransaction_test('SPI');
-SELECT * FROM subtransaction_tbl;
-TRUNCATE subtransaction_tbl;
-SELECT subtransaction_test('Python');
-SELECT * FROM subtransaction_tbl;
-TRUNCATE subtransaction_tbl;
-
--- Context manager case for Python >=2.6
-
CREATE FUNCTION subtransaction_ctx_test(what_error text = NULL) RETURNS text
AS $$
with plpy.subtransaction():