Re: MERGE/SPLIT PARTITIONS issues/questions

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Melanie Plageman <melanieplageman(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MERGE/SPLIT PARTITIONS issues/questions
Date: 2026-08-19 11:58:10
Message-ID: CAPpHfdv=7MpwkS-n_ECzdM0C9WmpNjNG68mr3gyhAu2qADp9Yg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, Aug 18, 2026 at 6:48 AM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> On Mon, Aug 17, 2026 at 6:27 PM Alexander Korotkov <aekorotkov(at)gmail(dot)com> wrote:
> >
> > Any objections to pushing these 4 fixes?
>
> As mentioned in [1], RestrictSearchPath is called before
> MergePartitionsMoveRows and SplitPartitionMoveRows.
> This means that if an expression contains anything non-immutable, we can't
> evaluate it consistently for every row under a restricted search path,
> imagine function text_regclass.
> It would be better to add a comment directly above SplitPartitionMoveRows and
> MergePartitionsMoveRows to mention this situation.
> This will help future readers understand the implications.
>
> In MergePartitionsMoveRows, the `foreach(ltab, *wqueue)` can be removed,
> because ATExecMergePartitions->createPartitionTable doesn't call
> ATGetQueueEntry.
> Similarly, the foreach loop in deleteSplitPartitionContext can also be
> removed for the same reason,
> we can probably get rid of deleteSplitPartitionContext.
>
> [1]: https://www.postgresql.org/message-id/CACJufxHk0F%2B1UyvExHoMfBZrsUeGQiB8MBm1PC5Fd3MtAszLGw%40mail.gmail.com

Agree on your corrections expect for deleteSplitPartitionContext(): it
still have resources to free. The revised patchset is attached.

------
Regards,
Alexander Korotkov
Supabase

Attachment Content-Type Size
v5-0001-Don-t-logically-decode-MERGE-SPLIT-PARTITION-row-.patch application/octet-stream 11.2 KB
v5-0003-Don-t-recalculate-generated-columns-during-MERGE-.patch application/octet-stream 56.6 KB
v5-0004-Reject-MERGE-SPLIT-of-partitions-with-row-level-s.patch application/octet-stream 15.3 KB
v5-0002-Peserve-replica-identity-and-publications-in-MERG.patch application/octet-stream 24.8 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2026-08-19 15:22:15 Re: BUG #19629: pg_restore_relation_stats reports XX000 instead of proper SQLSTATE for input validation errors
Previous Message Alexander Korotkov 2026-08-19 11:31:53 Re: MERGE/SPLIT PARTITIONS issues/questions

Browse pgsql-hackers by date

  From Date Subject
Next Message Zsolt Parragi 2026-08-19 12:06:07 Re: Add explicit warnings about unsafe OAuth trace output for libpq
Previous Message Jonathan Gonzalez V. 2026-08-19 11:53:21 Re: Introduce psystem() to replace system()