Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti
Date: 2025-07-14 23:17:47
Message-ID: 799185.1752535067@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> BTW, d55322b0d simply made it easy to trigger the bug from psql.
> If I use current psql to connect to older servers, I can demonstrate
> crashes (or sometimes "stack depth limit exceeded") back to v12.

I think I fat-fingered something, because now I can only reproduce back
to v13. Bisecting says the crash started at the v13-era commit

commit 2f9661311b83dc481fc19f6e3bda015392010a40
Author: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Date: Mon Mar 2 18:19:51 2020 -0300

Represent command completion tags as structs

which is unsurprising because that's what introduced the
Assert we're hitting.

BTW, with Asserts disabled it works fine:

$ psql postgres
psql (19devel)
Type "help" for help.

postgres=# \parse s

postgres=# execute s;
EXECUTE

which is another reason not to start throwing an error.
(I did not look into how come that works... the correct
command tag must be getting filled in later, but where?)

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2025-07-15 03:54:46 Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti
Previous Message Tom Lane 2025-07-14 22:05:50 Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti