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

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, exclusion(at)gmail(dot)com
Subject: Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti
Date: 2025-07-14 21:11:31
Message-ID: CAJ7c6TOoGUosKwdXt1LwJpThvP2-ZNpuv0H=owYdp6omwQ=keA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

> That being the case, maybe we should band-aid this by returning
> EXECUTE if the prepared statement is empty.

This sounds pretty straightforward and seems to solve the problem.
Patch attached.

```
eax=# \parse s
eax=# execute s;
ERROR: EXECUTE can't execute an empty query
eax=# select 1 \parse s2

eax=# execute s2;
?column?
----------
1
(1 row)
```

Attachment Content-Type Size
v1-0001-Don-t-allow-to-execute-an-empty-query.patch text/x-patch 863 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Aleksander Alekseev 2025-07-14 21:33:11 Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti
Previous Message Tom Lane 2025-07-14 19:36:01 Re: BUG #18984: Empty prepared statement from psql \parse triggers assert in PortalRunMulti