Re: psql's FETCH_COUNT (cursor) is not being respected for CTEs
Daniel Verite <daniel@manitou-mail.org>
From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Robert Haas
<robertmhaas@gmail.com>,
Jakub Wartak <jakub.wartak@enterprisedb.com>
Date: 2024-04-08T14:25:36Z
Lists: pgsql-hackers
Tom Lane wrote: > I've reconsidered after realizing that implementing FETCH_COUNT > atop traditional single-row mode would require either merging > single-row results into a bigger PGresult or persuading psql's > results-printing code to accept an array of PGresults not just > one. Either of those would be expensive and ugly, not to mention > needing chunks of code we don't have today. Yes, we must accumulate results because the aligned format needs to know the columns widths for a entire "page", and the row-by-row logic does not fit that well in that case. One of the posted patches implemented this with an array of PGresult in single-row mode [1] but I'm confident that the newer version you pushed with the libpq changes is a better approach. > So I whacked the patch around till I liked it better, and pushed it. Thanks for taking care of this! [1] https://www.postgresql.org/message-id/092583fb-97c5-428f-8d99-fd31be4a5290@manitou-mail.org Best regards, -- Daniel Vérité https://postgresql.verite.pro/ Twitter: @DanielVerite
Commits
-
Further review for re-implementation of psql's FETCH_COUNT feature.
- c21d4c416ad6 17.0 landed
-
Re-implement psql's FETCH_COUNT feature atop libpq's chunked mode.
- 90f5178211cd 17.0 landed
-
Support retrieval of results in chunks with libpq.
- 4643a2b265e9 17.0 landed
-
Attempt to fix newly added Memoize regression test
- a3a836fb5e51 17.0 cited