public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Daniel Verite <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Jakub Wartak <[email protected]>
Subject: Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs
Date: Fri, 29 Mar 2024 14:07:06 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Tue, 2024-01-30 at 15:29 +0100, Daniel Verite wrote:
> PFA a rebased version.

I had a look at patch 0001 (0002 will follow).

> - <sect1 id="libpq-single-row-mode">
> -  <title>Retrieving Query Results Row-by-Row</title>
> + <sect1 id="libpq-chunked-results-modes">
> +  <title>Retrieving Query Results by chunks</title>

That should be "in chunks".

> +    <para>
> +   <variablelist>
> +    <varlistentry id="libpq-PQsetChunkedRowsMode">
> +      <term><function>PQsetChunkedRowsMode</function>
> +        <indexterm><primary>PQsetChunkedRowsMode</primary></indexterm></term>
> +     <listitem>
> +      <para>
> +       Select the mode retrieving results in chunks for the currently-executing query.

That is questionable English.  How about

  Select to receive the results for the currently-executing query in chunks.

> +       This function is similar to <xref linkend="libpq-PQsetSingleRowMode"/>,
> +       except that it can retrieve a user-specified number of rows
> +       per call to <xref linkend="libpq-PQgetResult"/>, instead of a single row.

The "user-specified number" is "maxRows".  So a better wording would be:

  ... except that it can retrieve <replaceable>maxRows</replaceable> rows
  per call to <xref linkend="libpq-PQgetResult"/> instead of a single row.

> -    error.  But in single-row mode, those rows will have already been
> +    error.  But in single-row or chunked modes, those rows will have already been

I'd say it should be "in *the* single-row or chunk modes".

> --- a/src/interfaces/libpq/fe-exec.c
> +++ b/src/interfaces/libpq/fe-exec.c
> @@ -41,7 +41,8 @@ char     *const pgresStatus[] = {
>     "PGRES_COPY_BOTH",
>     "PGRES_SINGLE_TUPLE",
>     "PGRES_PIPELINE_SYNC",
> -   "PGRES_PIPELINE_ABORTED"
> +   "PGRES_PIPELINE_ABORTED",
> +   "PGRES_TUPLES_CHUNK"
>  };

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 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".
That should save some code repetition.

Yours,
Laurenz Albe






view thread (2+ 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]
  Subject: Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs
  In-Reply-To: <[email protected]>

* 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