Re: fix crash with Python 3.11

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fix crash with Python 3.11
Date: 2022-01-25 14:21:15
Message-ID: 73daabb7-9fc7-fb7a-5e06-a968c611b032@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16.01.22 23:53, Tom Lane wrote:
> I think a possible fix is:
>
> 1. Before entering the PG_TRY block, check for active subtransaction(s)
> and immediately throw a Python error if there is one. (This corresponds
> to the existing errors "cannot commit while a subtransaction is active"
> and "cannot roll back while a subtransaction is active". The point is
> to reduce the number of system states we have to worry about below.)
>
> 2. In the PG_CATCH block, after collecting the error data do
> AbortOutOfAnyTransaction();
> StartTransactionCommand();
> which gets us into a good state with no active subtransactions.
>
> I'm not sure that those two are the best choices of xact.c
> entry points, but there's precedent for that in autovacuum.c
> among other places.

AFAICT, AbortOutOfAnyTransaction() also aborts subtransactions, so why
do you suggest the separate handling of subtransactions?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-01-25 14:22:45 Re: Add connection active, idle time to pg_stat_activity
Previous Message Ashutosh Bapat 2022-01-25 14:08:09 Re: Foreign join search stops on the first try