public inbox for [email protected]
help / color / mirror / Atom feedFrom: Jelte Fennema-Nio <[email protected]>
To: Dave Cramer <[email protected]>
Cc: Sami Imseih <[email protected]>
Cc: Hannu Krosing <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Jacob Champion <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Heikki Linnakangas <[email protected]>
Subject: Re: Proposal to allow setting cursor options on Portals
Date: Mon, 6 Apr 2026 11:37:01 +0200
Message-ID: <CAGECzQQLOkWHLWE8MCAY+-T=Lsfb8yiEWE9LSmNgMHHQSK=+mw@mail.gmail.com> (raw)
In-Reply-To: <CADK3HH+AKcTUas-W7ZodeVzfwJgXWQH8NM1O=-550eU-hgrB5A@mail.gmail.com>
References: <CADK3HHKe1PA1U6aB5-7tWBQ0yZGgNvY7H=ECDD9955Pas_zx_Q@mail.gmail.com>
<CAGECzQRQ5optaG4DPbshKS+zpUtn_oceh8-qdshFbS+-FSb8Dg@mail.gmail.com>
<CAOYmi+nVQRpSs3vd_v9L8ytO9wnL2ndnzGwU31aDGorVFxrAYA@mail.gmail.com>
<CAGECzQSZ43JMjA8QEJoF9DCdTO0GQeR2qyhouQciSG2ik40Yhg@mail.gmail.com>
<CAOYmi+m20jS8zZ2qFpSnvhaqGDX+vtgCsqcu9VhokyLqF8kFag@mail.gmail.com>
<CADK3HH+DPY_x_H=e0c_AVWoUP9E+YXdyJDVvmzYEYxZXT87Agw@mail.gmail.com>
<CAGECzQRZwbuSNp-mgPWmC97q63ODAun=pQtXa1Ru19ksz986Hg@mail.gmail.com>
<CADK3HHKDrnRAoAcUv1ucLB0o_ZUcJRwm+jonNPNUHoDtcA9Crw@mail.gmail.com>
<CAGECzQQriv-h_h8Ygxh_RfnLt2G4P9nWrpgMi9YL2bmcOLbUEA@mail.gmail.com>
<CADK3HHL_cUzm-R+0nHcLvxdOZQeR0YKQMDjwLTEiGX-F9=tbeA@mail.gmail.com>
<CADK3HH+o9dTYsXpCk7-Z0JW-QB2TV7=e97O8B-XDOGQb14AfSQ@mail.gmail.com>
<CAOYmi+kkTbuwGa9X=XomNivAw9P4hN3M1U7QXiP7Jw+nrQXtNQ@mail.gmail.com>
<CAGECzQSfCPXdOpUKfdkPA9iZhGyRjZAad-CXbhApZ2CnjgG2kw@mail.gmail.com>
<CAOYmi+=qE1khrtTD7oQVPJQTHoXffQQ0DPHOx870r7801zhw9g@mail.gmail.com>
<[email protected]>
<CADK3HH+6MTrMBsW+iDJ0VGzu7HQKJLLQbjnbdps3kK8Ug5prUg@mail.gmail.com>
<CA+TgmoavFJW984Y8cUv-U9K+JqxYgqEj-i1A1dORwvyki5642A@mail.gmail.com>
<CAGECzQSHKR2LtBSnDT_bjdpE1=cVzZLRcb2k5d_K=BMvJCFihg@mail.gmail.com>
<[email protected]>
<CADK3HH+TnNaW-b+d8xkUDcFZ-4oWhh5q3hCzbyuR9ShwMasHrA@mail.gmail.com>
<CA+TgmoYr2RsE9OUwo42sxtpHr8gpdTtY6mGrWBbzu2sdFf6s8A@mail.gmail.com>
<CADK3HHJ6TqYHgctgOTbuLJNHiKm5i_UE--goMKbcG7+5g2-fpQ@mail.gmail.com>
<CAMT0RQRFa43CAf773LaDUvBYmZtwcNfdQSAzpBUtdJ+EiHH=kQ@mail.gmail.com>
<CADK3HHKO0jXxj+r5f=qLJG-L20w0kw6mm9rR0dvUStwqiM+zkA@mail.gmail.com>
<CADK3HHLvsPbz3e=1=N3TSYoB6B-d6AM3nUFK-SvWJSzfysKxrA@mail.gmail.com>
<CADK3HH+Vef1fWVYj3eH0YnCVgHcWX981UA=Y4k0jCKjwVg-1PA@mail.gmail.com>
<CADK3HHJHGPrzWpwmVPErq9XOcdg8nue-gPfoSz_=kabiKoZCOg@mail.gmail.com>
<CAA5RZ0u=M0u1FHu1bFxYUoFCON=8OiQamdEnAH4-EJNDbYH7Xg@mail.gmail.com>
<CAA5RZ0uESzrmA5zwHC=Uye2aH9_jHfHX7qAJPgUh8s_JLLn7PA@mail.gmail.com>
<CADK3HH+JtK=-EDO0RzWjD5aV-Wa+DG991at=vmQa08KY6YY1Dg@mail.gmail.com>
<CAGECzQTcWG4Y7nuZ7vjkcDFQKnH9uYd3gf411WBuv-6L8zChvA@mail.gmail.com>
<CADK3HH+AKcTUas-W7ZodeVzfwJgXWQH8NM1O=-550eU-hgrB5A@mail.gmail.com>
On Wed, 25 Mar 2026 at 15:34, Dave Cramer <[email protected]> wrote:
> Attached is v4 of the patch
> Co-Authored by Sami Imseih
>
> Adds docs and test module
It's looking much more finished
> The portal can
> later be operated on with cursor commands such as FETCH, MOVE,
> and CLOSE.
This made me realize that, adding the Bind side of cursors is only
half of the equation. The "Execute" message should also gain new
behaviour to support all the same functionality as FETCH and MOVE. I
think we can do that fairly easily by adding similar flags to Execute.
I think we'd need three flags:
1. MOVE
2. BACKWARD
3. ABSOLUTE
I do realize the scope creep of this, but it feels that without
addressing Execute we have a half-finished feature. That could be
fine, but then I don't think we should call the option
_pq_.protocol_cursor. Because that sounds like it solves the whole
half-baked protocol-level cursor implemention that we currently have.
Maybe _pq_.cursor_bind instead.
I think the "protocol_" part in _pq_.protocol_cursor is duplicative.
The _pq_ part already indicates that it's a protocol option, so I'd
leave that out.
> <symbol>PQ_BIND_CURSOR_SCROLL</symbol> (scroll),
> <symbol>PQ_BIND_CURSOR_NO_SCROLL</symbol> (no scroll), and
> <symbol>PQ_BIND_CURSOR_HOLD</symbol> (hold).
> These are defined in <filename>libpq-fe.h</filename>.
and
> <para>
> Bitmap set by protocol extensions.
> </para>
I think the Message Formats page should list the actual flag values
that are valid. The protocol docs should not require you to look at
the postgres source code.
/*
* Only override the default cursorOptions when the client has
* explicitly set flags. A value of 0 means no cursor options were
* requested, so keep the CreatePortal defaults.
*/
What is the difference between setting cursorOptions = 0 and the
CreatePortal defaults?
> {"protocol_cursor", NULL, "0", NULL,
> "Protocol-Cursor", "", 1,
> offsetof(struct pg_conn, protocol_cursor)},
In my GoAway patchset I linked enabling the protocol extension to the
user requesting protocol v3.2 (or higher).
> /* Reject any bits we don't recognize */
> if (bind_ext_flags & ~0x0007)
Let's use PQ_BIND_CURSOR_VALID_FLAGS here too instead of this magic number.
> src/test/modules/libpq_protocol_cursor/libpq_protocol_cursor.c
I think it'd be better to put these tests in the libpq_pipeline test
file. Then we can keep all the libpq tests together so they can share
the helper logic.
view thread (39+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Proposal to allow setting cursor options on Portals
In-Reply-To: <CAGECzQQLOkWHLWE8MCAY+-T=Lsfb8yiEWE9LSmNgMHHQSK=+mw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox