From 008071a3f1175ac6dac580794434b4135144926c Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Sat, 20 Jun 2026 17:06:19 -0700 Subject: [PATCH 1/3] pdo_pgsql: document ATTR_PREFETCH lazy fetch, fix copyFromArray signature --- reference/pdo/constants.xml | 7 +++++ reference/pdo_pgsql/pdo-pgsql.xml | 26 +++++++++++++++++++ .../pdo_pgsql/pdo/pgsql/copyfromarray.xml | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/reference/pdo/constants.xml b/reference/pdo/constants.xml index 36d98257f991..b537a419eb83 100644 --- a/reference/pdo/constants.xml +++ b/reference/pdo/constants.xml @@ -251,6 +251,13 @@ setting of the prefetch size. A larger prefetch size results in increased performance at the cost of higher memory usage. + + The PDO_PGSQL driver instead treats this attribute as a toggle: as of + PHP 8.5.0, a value of 0 enables lazy (single-row) + fetching. See + PDO::ATTR_PREFETCH + in the PDO_PGSQL driver. + diff --git a/reference/pdo_pgsql/pdo-pgsql.xml b/reference/pdo_pgsql/pdo-pgsql.xml index d2a72332dd47..edb20d6c7fb2 100644 --- a/reference/pdo_pgsql/pdo-pgsql.xml +++ b/reference/pdo_pgsql/pdo-pgsql.xml @@ -155,6 +155,32 @@ + + PDO::ATTR_PREFETCH + + + As of PHP 8.5.0, setting this attribute to 0 enables + lazy (single-row) fetching: rows are retrieved from the server one at a + time as they are fetched, instead of buffering the whole result set in + memory before the first PDOStatement::fetch + call. This reduces memory usage for large result sets. Any other value + keeps the default buffered behavior. + + + It can be set per connection with + PDO::setAttribute, or per statement via + the PDO::prepare or + PDO::query driver options. + + + + In lazy mode, a connection can have only one active statement at a + time. Running another statement silently discards any unread rows of + the previous one; no error is raised. + + + + Pdo\Pgsql::TRANSACTION_IDLE diff --git a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml index e29012235a32..93e3f2782c2c 100644 --- a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml +++ b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml @@ -10,7 +10,7 @@ public boolPdo\Pgsql::copyFromArray stringtableName - arrayrows + arrayTraversablerows stringseparator"\t" stringnullAs"\\\\N" stringnullfields&null; From 0a957a734082e4dd8f51b820ab24173544c3033a Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Mon, 22 Jun 2026 14:16:41 -0700 Subject: [PATCH 2/3] Apply suggestion from @lacatoire Co-authored-by: Louis-Arnaud --- reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml index 93e3f2782c2c..3f382a20741f 100644 --- a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml +++ b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml @@ -38,7 +38,9 @@ An indexed array of strings with fields - separated by separator. +An indexed array (or Traversable) of +strings with fields separated by +separator. From 6ae42ac089e17fcfd9a056aecac113f1552636f2 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Mon, 22 Jun 2026 14:20:12 -0700 Subject: [PATCH 3/3] pdo_pgsql: fix ATTR_PREFETCH link and copyFromArray rows whitespace --- reference/pdo/constants.xml | 6 +++--- reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/reference/pdo/constants.xml b/reference/pdo/constants.xml index b537a419eb83..285a16ffe336 100644 --- a/reference/pdo/constants.xml +++ b/reference/pdo/constants.xml @@ -254,9 +254,9 @@ The PDO_PGSQL driver instead treats this attribute as a toggle: as of PHP 8.5.0, a value of 0 enables lazy (single-row) - fetching. See - PDO::ATTR_PREFETCH - in the PDO_PGSQL driver. + fetching; see the + PDO_PGSQL driver docs + for details. diff --git a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml index 3f382a20741f..7f2e3ffed133 100644 --- a/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml +++ b/reference/pdo_pgsql/pdo/pgsql/copyfromarray.xml @@ -37,10 +37,9 @@ rows - An indexed array of strings with fields -An indexed array (or Traversable) of -strings with fields separated by -separator. + An indexed array (or Traversable) of + strings with fields separated by + separator.