Re: Fix RETURNING side effects for FOR PORTION OF leftover rows

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix RETURNING side effects for FOR PORTION OF leftover rows
Date: 2026-07-25 10:16:03
Message-ID: CAEZATCUSwmty56ALUhnZ5Y=DVtFf0YLE+JoJpXL9+q7quu5K1w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 20 Jul 2026 at 17:21, Paul A Jungwirth
<pj(at)illuminatedcomputing(dot)com> wrote:
>
> On Mon, Jul 20, 2026 at 6:17 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
> >
> > PFA v2 with the new implementation. I tried to run check-world and it passed.
>
> Nice catch. I took a look at the v2 patch. It looks like a good fix to
> me. I'm happy that we're testing cross-partition updates as well.
> Thanks for the quick fix!

Sorry for the delay getting back to this.

The fix looks good to me, and the point about cross-partition updates
is a good one.

Attached is a v3 patch, in which I reworked the comments a bit, and
moved the logic of the new check to the place it's actually used. I
also changed the tests to use a NOTICE-raising function instead of a
sequence, since that makes it clearer which rows are/were being
processed by the RETURNING clause.

Regards,
Dean

Attachment Content-Type Size
v3-0001-Avoid-RETURNING-side-effects-for-FOR-PORTION-OF-l.patch text/x-patch 8.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Burd 2026-07-25 10:35:44 Re: [PATCH] Batched clock sweep to reduce cross-socket atomic contention
Previous Message Fujii Masao 2026-07-25 10:15:25 Re: Allow pg_read_all_stats to see database size in \l+