Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w5Ix2-00370R-11 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 07:46:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5Ix0-00Cp4C-2d for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Mar 2026 07:46:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w5Ix0-00Cp31-1c for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 07:46:50 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5Iwy-000000011o2-1c0j for pgsql-hackers@lists.postgresql.org; Wed, 25 Mar 2026 07:46:50 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5a1307438ddso5065228e87.1 for ; Wed, 25 Mar 2026 00:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774424808; cv=none; d=google.com; s=arc-20240605; b=B1LSWaUotsHj2yi0YlBIh/8wjX5kcUPuPQoOBImJgPS2Y4WGaNpaasSbEINFf+d9PN tTInbGVz58sDfSdK4a9ZXF7Jj0B8e9ikcrw4nVC7PX01DIUM3Gi6bdBs4GhzF0FXmqF+ Ui2EQnjaDjc57pFEPkddUjELClbs2GzUUES31t/ovGTdS++5nTTM2Xm5RnGeMDLDT6uw nZ0zZiDAP4gd9NR1zy3K2UR/HxQwxTdOp5xiDaQTHJf4SxO+H4oiK3nZph8ts8PuSP1i oq5e+vTAWlD/xPCV1mcPz3ybf3Hp+oAmSnAIRorZyvQqnrb/QOyp8fV3Gzqns8mtBn+7 SDXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=CIVpxrAAz72EineTv8Yhlv9vwbTHHswEgPMoD9kANvs=; fh=Vj1GuAfuP1Wm6VuIj5hNrpJjgYJo8Co1LIveROtfbRs=; b=gvC/Tz02jv7sSf+LayQiN4yEfE9rqkWH/IGVUOfd3qn8Va0mmsaQZXoGGOilR6jyGA KfHoKqQX1fT9l7FP8kjEW/q7mDZbiHYk3nWOVtwNB2AmSXrl7iRPTvmABZ2hZxLEchWu e39snfU4iYxtPX6dH5qaEwFZ3q28lzUknYqWesFALBDD+Ve6t2nhy6fvzsWSannuJQLe tijGkrTpeXuK2xa0wPhHR0/3vrb0r87iur07Z5onU/hIvCjrD2Wv9les67iXa4H8Ahfs 2On4+AARTB4UzvuELzT1FSOhxecOSjYNNv6QT4BPsu7y2LXcYSnYgQro3kaK8o+EqpBS IYrQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jeltef.nl; s=google; t=1774424808; x=1775029608; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CIVpxrAAz72EineTv8Yhlv9vwbTHHswEgPMoD9kANvs=; b=KBfyiw6jD0ZbdEmcSKxxtgPAoSI3O0NoymbPNar7pAr+GBxMz4Rx7/2x7xkgDWd2xW PpH72u/nbW9+jOYMr7y8jfCZw2fQL4NBO0YNOzBdwShYiuZzBHDnUO8xchwYRlur7Hvj o4/UrGUx3E9I8CCLpE8VIc7Fg7A8HYPPMnYAVKgioXMZw8rWyFHP+Dk1XbdVqpSapLPI sp1yn0oQoxs71aTwSQm4+klY21I5MhZfX6tSV5q1kgLezWY9OQyH98SihK8r8TLnq5VS vnRbiMpWoyKgRXES0rm2cfsoE7MHr2ks9usmvBobBVRDUZCxs0EKu4JPXVkDSD2rKE93 Fy6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774424808; x=1775029608; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=CIVpxrAAz72EineTv8Yhlv9vwbTHHswEgPMoD9kANvs=; b=ZqOrmc51E7/ep13MHfeG2bAn13Pl7qVPo2pBHmbByLYMeIYoPuurRocAVCqBObeYuz GAW3QBHryJ5lYXJy5vyWyX1hX3p4vfK04dSZzrLwBIkT7+eLLsAh4r+quUB1vdBtK4z7 ihxnAaZAuDSo9JRpnzJ57NW321kztGpAfLo9WuF1WrF6KFatqOq9neNzhMOOWdOxGq+N kXnyZfVZ/hiBybM5MFx2ioYi3i3gmrod3KU4IUPFtRGJD/YsNdKVdK7CM5jYiKyNna3I Cs+AUBXH3qYySFq/MGfL/nbX3TfyXmtMn5aZ9AAjOyCd6X4rk0Bh0UDihXgWeCwrVwhB u2fw== X-Forwarded-Encrypted: i=1; AJvYcCXOHcvwkhUTA8h1PB+GPrKnPqbQUiJq4USBFyQqA/+jshbHVD5p6+AuU2kNSmbW85Buwyqrcza417mbScYR@lists.postgresql.org X-Gm-Message-State: AOJu0YzqcwOmKhTkiCBPr7NxBL9yF92PK6bNq00O4aLN3RILhJC8yu0M AitdssO5vvTyTjaZwVUGz1ZRsbRPpsL375CYTAaRN0JwglBjxec1GsRCmEj5kfuu0pIkAXp1J13 PEPPMd196KNfXDVVSFfPoFC+e4SbMpuGXww5J93hkyg== X-Gm-Gg: ATEYQzxJ+HCHhp2lh4pvH+tlb2vDYhk7r5Gfb/2kZJg/F4WDFVDUTxdtC2a35VCOwoZ P8UVkFo8mL9ynHWAUzd6ojdc1lj5ht/DikPI1ozP100ELKl7URlZpS9VA5bq4sIuRhi5iKdHVug y1EoCpk+S8NKj9+a+AuZatp6heRY67TlIOtJ6kYbyd5smgbf5kmYR01nudlWiNOA0scBspjWJyx sft3afNVrZlX2C0NQBVSK3Ao714PHQ/BawazMWP+NOPFCq4FgL7LKLjbNBzZ1kV37yXxQ2UFN3N euIgh2AJhyIDtk0DkoiSeWgeZ+Rvj22qarSxpQ== X-Received: by 2002:a05:6512:6d3:b0:5a1:64ff:a6fa with SMTP id 2adb3069b0e04-5a29b985304mr884006e87.16.1774424807541; Wed, 25 Mar 2026 00:46:47 -0700 (PDT) MIME-Version: 1.0 References: <2155281.1767900170@sss.pgh.pa.us> <431484.1768433414@sss.pgh.pa.us> In-Reply-To: From: Jelte Fennema-Nio Date: Wed, 25 Mar 2026 08:46:35 +0100 X-Gm-Features: AaiRm51v64Ywe4Vq3elfEpWe0CiueCBD9UiQJzOS1y3fWlxBBIoD33wU7-iu2Co Message-ID: Subject: Re: Proposal to allow setting cursor options on Portals To: Dave Cramer Cc: Sami Imseih , Hannu Krosing , Robert Haas , Tom Lane , Jacob Champion , PostgreSQL Hackers , Heikki Linnakangas Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 24 Mar 2026 at 11:01, Dave Cramer wrote: > _pq_.cursor would be fine. I think that makes sense as a name for the option. I think adding flag support for SCROLL and NO SCROLL would make sense in that case. Some notes on the patch (but I didn't look look at the client side libpq code in detail): For the protocol definition I'd like a few changes: 1. I'd like the new field in the bind message that you add to be described as an extension bitmap, not specifically for cursor options, so that future extensions could add bits too it too. 2. Related to that, I think the used bits should not align with the internal bits. Having the only valid flag bit be 0x0020 is kinda weird. Let's just make that 0x0001. We could update the internal ones to match if desired, but I think it's fine for the protocol bits to differ from the bits in the postgres server. Docs still mention CURSOR_OPT_BINARY, but support for that has been removed from the code afaict (which I think is indeed what should happen) There's a bunch of protocol version 3.3 code still around, which should be removed now that the protocol option is added. PQsendBindWithCursorOptions and PQsendQueryPreparedWithCursorOptions should error out if conn->holdable_portal_enabled is false. Right now it silently skips the cursor options if the connection does not support the protocol extension. There should be a libpq function to inspect whether the connection supports cursor options, so some kind of graceful fallback logic can be implemented by the application when it's not supported. libpq docs are missing