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: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, exclusion(at)gmail(dot)com
Subject: Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti
Date: 2025-07-14 22:05:50
Message-ID: 792012.1752530750@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I wrote:
> The attached quick draft (needs attention to comments) results in
> regression=# \parse s
> regression=# execute s;
> EXECUTE
> which matches the behavior of pre-v12 servers.

Another way that's perhaps a bit less magical is to make
ExecuteQuery substitute the right thing, as attached.

I'm not entirely sure whether this leaves any other code
paths that can reach that Assert; but on the other hand,
if there are any, CMDTAG_EXECUTE is probably wrong for them.

BTW, the reason why EXPLAIN EXECUTE isn't at risk is that it's
going to return CMDTAG_EXPLAIN.

regards, tom lane

Attachment Content-Type Size
wip2-avoid-failure-with-empty-prepared-query.patch text/x-diff 1.2 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2025-07-14 23:17:47 Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti
Previous Message Tom Lane 2025-07-14 21:40:22 Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti