| From: | Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com> |
|---|---|
| To: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
| Cc: | Dean Rasheed <dean(dot)a(dot)rasheed(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-20 16:21:06 |
| Message-ID: | CA+renyXrMqiiNRWAA-pXj8peHRSP7RnT6PyiQ0gmuHK6i5gdkg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Jul 20, 2026 at 6:17 AM Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote:
>
> Okay. We cannot simply check node->forPortionOf to bypass RETURNING processing, because an FPO update on a partitioned table may move a row to a different partition. In that case, ExecInsert() is also called to insert the row into the new partition.
>
> However, in that case, mtstate->operation is still CMD_UPDATE, while for leftover rows, mtstate->operation is temporarily changed to CMD_INSERT. So we can check both node->forPortionOf and mtstate->operation.
>
> 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!
Yours,
--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marcos Pegoraro | 2026-07-20 16:21:38 | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |
| Previous Message | Philip Alger | 2026-07-20 16:00:52 | Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement |