pgsql: plpgsql: Apply the too_many_rows check to EXECUTE ... INTO

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: plpgsql: Apply the too_many_rows check to EXECUTE ... INTO
Date: 2026-11-16 02:06:59
Message-ID: E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

plpgsql: Apply the too_many_rows check to EXECUTE ... INTO

EXECUTE ... INTO without STRICT silently discarded all but the first
result row even when plpgsql.extra_warnings or plpgsql.extra_errors
included too_many_rows. Although the documented check was not limited
to static SQL, dynamic SQL only checked for multiple rows when STRICT
was specified.

Honor the too_many_rows setting for dynamic SQL as well, reporting a
warning or error as configured. STRICT continues to require exactly
one row regardless of these settings.

Also add a hint to errors reported when EXECUTE ... INTO STRICT returns
multiple rows.

Do not backpatch, since enabling this check can cause previously
successful statements to fail.

Author: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Reviewed-by: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Reviewed-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAM2+6=WikOK3t=LN+jhzNBchrO3uy0tzVPuPygnz9yoUTwnb6Q@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ffc82103773eea1ab5aa699edc301d4f03de4ce

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 22 ++++++++++++++++------
src/test/regress/expected/plpgsql.out | 20 ++++++++++++++++++++
src/test/regress/sql/plpgsql.sql | 14 ++++++++++++++
3 files changed, 50 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-11-16 09:43:27 pgsql: Translation updates
Previous Message Zsolt Parragi 2026-11-15 21:15:36 Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned