Re: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dmitry Koval <d(dot)koval(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Date: 2025-10-01 05:01:09
Message-ID: CACJufxGc6e5wT3oXs3B8LHEs9pR4z9gmNx_UrX6EX9=pWzNkHg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

+ /*
+ * For simplify check for ranges of new partitions need to sort all
+ * partitions in ascending order of them bounds (we compare upper
+ * bound only).
+ */
+ lower_bounds = (PartitionRangeBound **)
+ palloc0(nparts * sizeof(PartitionRangeBound *));
+
+ /* Create array of lower bounds. */
+ for (i = 0; i < nparts; i++)
+ {
+ lower_bounds[i] = make_one_partition_rbound(key, i,
+ new_parts[i]->bound->lowerdatums, true);
+ }
+
I am confused by the above comments "we compare upper bound only".

some of the function partition_rbound_cmp can be replaced by marco
compare_range_bounds,
for example in check_two_partitions_bounds_range we can use
compare_range_bounds instead of partition_rbound_cmp
not sure if it's worth it or not.

doc:
<varlistentry id="sql-altertable-split-partition">
should come after
<varlistentry id="sql-altertable-merge-partitions">
I’ve refactored the SPLIT PARTITION docs quite a bit—let me know if they make
sense.
Also tweaked the regression tests a little again.

Attachment Content-Type Size
v61-0001-refactoring-based-on-v61.no-cfbot application/octet-stream 28.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2025-10-01 05:01:51 Re: [PATCH] Add tests for Bitmapset
Previous Message David Rowley 2025-10-01 05:00:59 Re: [PATCH] Add tests for Bitmapset