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.94.2) (envelope-from ) id 1rrKEV-00Gty8-Ej for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2024 16:10:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rrKEU-00GUyE-GG for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Apr 2024 16:10:02 +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.94.2) (envelope-from ) id 1rrKEU-00GUy6-77 for pgsql-hackers@lists.postgresql.org; Mon, 01 Apr 2024 16:10:02 +0000 Received: from dverite2024.planet-service.net ([185.16.44.252] helo=mail.verite.pro) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rrKER-008ArT-AW for pgsql-hackers@postgresql.org; Mon, 01 Apr 2024 16:10:01 +0000 Received: by mail.verite.pro (Postfix, from userid 1000) id E64322C02D1; Mon, 1 Apr 2024 18:09:57 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs From: "Daniel Verite" To: "Laurenz Albe" Cc: PostgreSQL Hackers , Tom Lane , Robert Haas , Jakub Wartak In-Reply-To: <7a3a478be2a16465ac93ba01b13e1081568cbbd9.camel@cybertec.at> Date: Mon, 01 Apr 2024 18:09:55 +0200 Message-Id: X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe wrote: > I had a look at patch 0001 (0002 will follow). Thanks for reviewing this! I've implemented the suggested doc changes. A patch update will follow with the next part of the review. > > --- a/src/interfaces/libpq/fe-exec.c > > +++ b/src/interfaces/libpq/fe-exec.c > > @@ -41,7 +41,8 @@ char *const pgresStatus[] =3D { > > "PGRES_COPY_BOTH", > > "PGRES_SINGLE_TUPLE", > > "PGRES_PIPELINE_SYNC", > > - "PGRES_PIPELINE_ABORTED" > > + "PGRES_PIPELINE_ABORTED", > > + "PGRES_TUPLES_CHUNK" > > }; >=20 > I think that PGRES_SINGLE_TUPLE and PGRES_TUPLES_CHUNK should be next to > each other, but that's no big thing. > The same applies to the change in src/interfaces/libpq/libpq-fe.h I assume we can't renumber/reorder existing values, otherwise it would be an ABI break. We can only add new values. > I understand that we need to keep the single-row mode for compatibility > reasons. But I think that under the hood, "single-row mode" should be the > same as "chunk mode with chunk size one". I've implemented it like that at first, and wasn't thrilled with the result. libpq still has to return PGRES_SINGLE_TUPLE in single-row mode and PGRES_TUPLES_CHUNK with chunks of size 1, so the mutualization did not work that well in practice. I also contemplated not creating PGRES_TUPLES_CHUNK and instead using PGRES_SINGLE_TUPLE for N rows, but I found it too ugly. Best regards, --=20 Daniel V=E9rit=E9 https://postgresql.verite.pro/ Twitter: @DanielVerite