| From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Support named (destination) portals in extended proto for psql meta commands. |
| Date: | 2025-12-17 06:40:37 |
| Message-ID: | CALdSSPiLFsrFu_eieL0bC3C=yq43mQvAfBD8DwGRnV8TvKYi0A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Sami, Jelte, thank you for looking into this.
On Sat, 13 Dec 2025 at 18:48, Sami Imseih <samimseih(at)gmail(dot)com> wrote:
>
> ```
> \portal name [max_rows]
>
> -- prepare the statements
> select from mytab limit $1 \parse p1
>
> -- bind/execute the statement, optionally to a portal
> \bind_named p1 10 \portal portalname \g
> \bind_named p1 50 \portal portalname \g
>
> -- bind/execute the statement, optionally to a portal, with max_rows
> \bind_named p1 50 \portal portalname 50 \g
> \bind_named p1 50 \portal portalname 40 \g
> ```
>
> The syntax may seem awkward, but we already do this with \bind,
> where the meta command is not at the start.
>
> ```
> select $ \bind 1 \g
> ```
The separate "\portal" command is the design I actually find
surprisingly simple and pretty. So, that's what I have implemented in
v1-0002.
I am now posting some WIP versions of changes. v1-0001 still needs
some comprehensive changes to the doc, but I decided to already post
something to this thread.
Another concern is changing the ABI of libpq. v1-0001 changes the
number of `PQsendQueryPrepared` parameters, and this is something that
has not been changed for 20+ years... Maybe the better choice would be
a new, separate function (which will still be just a proxy-function to
PQsendQueryGuts)?
Also, I think that we need to support closing destination portals
using psql meta-commands. The current design in my head is a separate
"'\close_cursor <name>" command. Since we still can cancel a portal
using SQL-level command (CLOSE), I think this should be separate
patches to the series. WHYT?
--
Best regards,
Kirill Reshke
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0002-Support-portal-meta-command-in-psql.patch | application/octet-stream | 8.1 KB |
| v1-0001-Add-destincation-portal-parameter-to-libpq-interf.patch | application/octet-stream | 12.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | jian he | 2025-12-17 06:41:06 | Re: create table like including storage parameter |
| Previous Message | VASUKI M | 2025-12-17 06:30:44 | Re: Custom oauth validator options |