Re: Adding some error context for lock wait failures

Zhang Mingli <zmlpostgres@gmail.com>

From: Zhang Mingli <zmlpostgres@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org, Steve Baldwin <steve.baldwin@gmail.com>
Date: 2025-07-11T03:32:50Z
Lists: pgsql-hackers
Hi,

On Jul 11, 2025 at 10:53 +0800, Tom Lane <tgl@sss.pgh.pa.us>, wrote:
> Zhang Mingli <zmlpostgres@gmail.com> writes:
> > Do we need to rollback error_context_stack to the previous state if we enter the branch for PG_CATCH()?
>
> No. The PG_TRY mechanism itself deals with that: the next outer
> level of PG_TRY will restore error_context_stack to what it had
> been. If this were not so, most other places that add an
> error_context_stack entry would also be broken.

Got it.  LGTM.


--
Zhang Mingli
HashData

Commits

  1. Clean up memory leakage that occurs in context callback functions.

  2. Provide error context when an error is thrown within WaitOnLock().