PostgreSQL 14.3 plpython not compatible with Python 3.11

Started by Honza Horakalmost 4 years ago4 messagesbugs
Jump to latest
#1Honza Horak
hhorak@redhat.com

The regression tests for plpython fail with PostgreSQL 14.3 when trying to
build it with the 3.11 (available for testing in a copr build, see below).

Steps to Reproduce:
1. set up a local mock config with Python 3.11 as described in the copr:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/
2. build postgresql 14.3

Actual results:

More cases of the following failures:

=== make failure: src/pl/plpython/regression.diffs ===
diff -U3
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/expected/python3/plpython_transaction.out
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/results/python3/plpython_transaction.out
---
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/expected/python3/plpython_transaction.out
    2022-05-31 20:02:30.754782055 +0200
+++
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/results/python3/plpython_transaction.out
     2022-05-31 20:02:32.867788655 +0200
@@ -70,10 +70,8 @@
 return 1
 $$;
 SELECT transaction_test3();
-ERROR:  spiexceptions.InvalidTransactionTermination: invalid transaction
termination
+ERROR:  SystemError: unknown opcode
 CONTEXT:  Traceback (most recent call last):
-  PL/Python function "transaction_test3", line 2, in <module>
-    plpy.execute("CALL transaction_test1()")
 PL/Python function "transaction_test3"
 SELECT * FROM test1;
  a | b
@@ -88,10 +86,8 @@

Also reported as:
https://bugzilla.redhat.com/show_bug.cgi?id=2092085

Regards,
Honza

#2Honza Horak
hhorak@redhat.com
In reply to: Honza Horak (#1)
Re: PostgreSQL 14.3 plpython not compatible with Python 3.11

Now I read more carefully that this issue was already mentioned by Tom in
the original bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2023272#c7

I was just confused not seeing the fix in the latest version... will try it.

Honza

On Tue, May 31, 2022 at 8:36 PM Honza Horak <hhorak@redhat.com> wrote:

Show quoted text

The regression tests for plpython fail with PostgreSQL 14.3 when trying to
build it with the 3.11 (available for testing in a copr build, see below).

Steps to Reproduce:
1. set up a local mock config with Python 3.11 as described in the copr:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/
2. build postgresql 14.3

Actual results:

More cases of the following failures:

=== make failure: src/pl/plpython/regression.diffs ===
diff -U3
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/expected/python3/plpython_transaction.out
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/results/python3/plpython_transaction.out
---
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/expected/python3/plpython_transaction.out
2022-05-31 20:02:30.754782055 +0200
+++
/builddir/build/BUILD/postgresql-14.3/src/pl/plpython/results/python3/plpython_transaction.out
2022-05-31 20:02:32.867788655 +0200
@@ -70,10 +70,8 @@
return 1
$$;
SELECT transaction_test3();
-ERROR:  spiexceptions.InvalidTransactionTermination: invalid transaction
termination
+ERROR:  SystemError: unknown opcode
CONTEXT:  Traceback (most recent call last):
-  PL/Python function "transaction_test3", line 2, in <module>
-    plpy.execute("CALL transaction_test1()")
PL/Python function "transaction_test3"
SELECT * FROM test1;
a | b
@@ -88,10 +86,8 @@

Also reported as:
https://bugzilla.redhat.com/show_bug.cgi?id=2092085

Regards,
Honza

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Honza Horak (#2)
Re: PostgreSQL 14.3 plpython not compatible with Python 3.11

Honza Horak <hhorak@redhat.com> writes:

Now I read more carefully that this issue was already mentioned by Tom in
the original bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2023272#c7

I was just confused not seeing the fix in the latest version... will try it.

Here's a quick rebase of that commit onto the v14 branch, in case it
helps.

regards, tom lane

Attachments:

fix-spi-commit-error-handling-v14.patchtext/x-diff; charset=us-ascii; name=fix-spi-commit-error-handling-v14.patchDownload+535-142
#4Honza Horak
hhorak@redhat.com
In reply to: Tom Lane (#3)
Re: PostgreSQL 14.3 plpython not compatible with Python 3.11

Thanks, it seems to be working fine with the Python 3.11 copr. It's
prepared now as a PR:
https://src.fedoraproject.org/rpms/postgresql/pull-request/52

Honza

On Tue, May 31, 2022 at 9:44 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Show quoted text

Honza Horak <hhorak@redhat.com> writes:

Now I read more carefully that this issue was already mentioned by Tom in
the original bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2023272#c7

I was just confused not seeing the fix in the latest version... will try

it.

Here's a quick rebase of that commit onto the v14 branch, in case it
helps.

regards, tom lane