Re: PL/Python: Fix return in the middle of PG_TRY() block.
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Xing Guo <higuoxing@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-01-13T07:23:46Z
Lists: pgsql-hackers
Hi,
On 2023-01-12 21:49:00 -0800, Andres Freund wrote:
> Clearly this would need a bunch more work, but it seems promising? I think
> there'd be other uses than this.
>
> I briefly tried to use it for spinlocks. Mostly works and detects things like
> returning with a spinlock held. But it does not like dynahash's habit of
> conditionally acquiring and releasing spinlocks.
One example is to prevent things like elog()/ereport()/SpinlockAcquire() while
holding a spinlock
The "locks_excluded(thing)" attribute (which is just heuristic, doesn't require
expansive annotation like requires_capability(!thing)), can quite easily be
used to trigger warnings about this kind of thing:
../../../../home/andres/src/postgresql/src/backend/access/transam/xlog.c:6771:2: warning: cannot call function 'errstart' while no_nested_spinlock 'in_spinlock' is held [-Wthread-safety-analysis]
elog(LOG, "logging with spinlock held");
Greetings,
Andres Freund
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Move return statements out of PG_TRY blocks.
- 0af386b0f4b8 11.20 landed
- 24964394a972 12.15 landed
- 800531846ef7 13.11 landed
- 52c9cf3239b8 14.8 landed
- 825ebc9848fd 15.3 landed
- 57d0051706b8 16.0 landed