pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: plpgsql: Apply the too_many_rows check to EXECUTE ... INTO
Date: Mon, 16 Nov 2026 02:06:59 +0000
Message-ID: <E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org> (raw)

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.chalke@enterprisedb.com>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.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(-)



Message-ID: <E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org>
Permalink:  ../E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org
  Subject: Re: pgsql: plpgsql: Apply the too_many_rows check to EXECUTE ... INTO
  In-Reply-To: <E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org>
  References: <E1xSm7X-00000000rfD-1uWR@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox