Re: Re: Bug: WAIT FOR LSN crashes with assertion failure inside PL/pgSQL DO blocks and procedures

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Xuneng Zhou <xunengzhou@gmail.com>
Cc: "wang.xiao.peng" <wxp_728@163.com>, SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-04-13T11:06:38Z
Lists: pgsql-hackers
On Fri, Apr 10, 2026 at 10:36 AM Xuneng Zhou <xunengzhou@gmail.com> wrote:
> I’ve revised the patch. Moving the non–top-level rejection to the
> beginning of the function may help avoid unnecessary parsing and
> validation work, although it could make the reasoning slightly less
> localized.
>
> Since this is user-facing, should we explicitly document this
> constraint to make the behavior less surprising? The rejection applies
> not only to wrapping the command in a procedure or function, but also
> within a DO block.
>
> It might also be worth adding a regression test and refining the error
> message accordingly. With this new constraint, some existing comments
> were outdated and have been updated as well.

Accepted, thank you.  Also, I've added errdetail() to clarify when the
statement could be not top-level.  Pushed.

------
Regards,
Alexander Korotkov
Supabase



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Explicitly forbid non-top-level WAIT FOR execution