Re: PL/pgSQL: apply the too_many_rows extra check to EXECUTE ... INTO

From: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PL/pgSQL: apply the too_many_rows extra check to EXECUTE ... INTO
Date: 2026-11-15 16:49:42
Message-ID: CAM2+6=UB2+Xp79N1LqX5y1eqFmOVmE=RrG5r41J8LSo572SeVQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 11, 2026 at 4:08 PM Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:

> On Tue, Nov 3, 2026 at 10:27 PM Jeevan Chalke
> <jeevan(dot)chalke(at)enterprisedb(dot)com> wrote:
> > If you think this is not needed, please feel free to ignore 0003.
>
> Yes, let's leave 0003 out for now.
>
> > 0002 removes "or use LIMIT 1" from the hint in both exec_stmt_execsql()
> and exec_stmt_dynexecute(), and updates the expected output accordingly.
>
> On second thought, LIMIT 1 would be useful advice for many SELECT queries.
> So, how about keeping it as a SELECT-specific example instead of removing
> it?
>
> Make sure the query returns a single row, for example by using LIMIT
> 1 with SELECT.
>
> > Attached is v3 with three patches:
> > 0001: the too_many_rows check for EXECUTE ... INTO (same as v1)
> > 0002: the hint change
> > 0003: the documentation change
>
> Thanks for updating the patches!
>
> I think it's better to put the hint change first, so the too_many_rows
> patch
> uses the revised hint from the start. So I revised the patches in that
> order.
> Attached. 0001 updates the hint, and 0002 adds the too_many_rows check.
>
> Barring any objections, I'm thinking to commit these to master.
>
> > One more thing: I proposed this for master only, since it changes
> behavior for users who have too_many_rows in extra_errors, and I'd
> appreciate your view on that as well.
>
> Agreed.
>

Hi Fujii-san,

Thank you for the review and for reordering the patches.

I agree with keeping LIMIT 1 as a SELECT-specific example, and with putting
the hint change first so that the too_many_rows patch uses the revised
wording from the start. I applied v4 on the latest HEAD, and it builds
without warnings. All tests pass.

Just one small observation on the 0002 commit message: it does not mention
that EXECUTE ... INTO STRICT errors also gain the hint now (the three
existing stricttest cases in plpgsql.out change accordingly). You may want
to add a sentence about that.

Also, agreed on committing to master only.

Thanks again!

>
> Regards,
>
> --
> Fujii Masao
>

--
*Jeevan Chalke*
*Senior Principal Engineer, Engineering Manager*
*Product Development*

enterprisedb.com <https://www.enterprisedb.com>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou 2026-11-15 17:13:15 Re: Add a hook for handling logical decoding messages on subscribers.
Previous Message Alexander Korotkov 2026-11-15 15:03:20 Re: test: avoid redundant standby catchup in 049_wait_for_lsn