Re: fix crash with Python 3.11

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: fix crash with Python 3.11
Date: 2022-02-24 19:34:05
Message-ID: 1533956.1645731245@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> * I'm not satisfied with using static storage for
> SaveTransactionCharacteristics/RestoreTransactionCharacteristics.

Looking closer at this, I was not too amused to discover that of the three
existing SaveTransactionCharacteristics calls, two already conflict with
each other: _SPI_commit calls SaveTransactionCharacteristics and then
calls CommitTransactionCommand, which again calls
SaveTransactionCharacteristics, overwriting the static storage.
I *think* there's no live bug there, because the state probably wouldn't
have changed in between; but considering we run arbitrary user-defined
code between those two points I sure wouldn't bet on it.

0001 attached is the same code patch as before, but now with spi.sgml
updates; 0002 changes the API for Save/RestoreTransactionCharacteristics.
If anyone's really worried about backpatching 0002, we could perhaps
get away with doing that only in HEAD.

I found in 0002 that I had to make CommitTransactionCommand call
SaveTransactionCharacteristics unconditionally, else I got warnings
about possibly-uninitialized local variables. It's cheap enough
that I'm not too fussed about that. I don't get any warnings from
the similar code in spi.c, probably because those functions can't
be inlined there.

regards, tom lane

Attachment Content-Type Size
0001-start-new-xact-in-SPI-commit-rollback-3.patch text/x-diff 30.7 KB
0002-fix-SaveTransactionCharacteristics-API-1.patch text/x-diff 6.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-02-24 19:35:20 Re: document that brin's autosummarize parameter is off by default
Previous Message David Christensen 2022-02-24 19:28:30 Re: [PATCH] add relation and block-level filtering to pg_waldump