Re: No Callbacks on FATAL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ed Behn <ed(at)behn(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: No Callbacks on FATAL
Date: 2023-01-11 23:10:33
Message-ID: 769879.1673478633@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ed Behn <ed(at)behn(dot)us> writes:
> I'm using a callback function that is called when a memory context is
> deleted to remove a temporary file. This works fine when the transaction
> ends normally or raises an ERROR. However, when a FATAL event happens, the
> callback is not run. Is this a bug or intended behaviour?

It's intended behavior, and I seriously doubt that it ever worked
differently.

> It seems to me that callbacks should be run in the event of a FATAL event
> in order to clean up any lingering issues.

They'd be far more likely to cause issues than cure them. Or at least
that's the design assumption. If you really need something here, put
it in an on_proc_exit callback not a memory context callback.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-01-11 23:11:32 Re: Show various offset arrays for heap WAL records
Previous Message Andres Freund 2023-01-11 23:09:51 Re: How to generate the new expected out file.