Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1, 13.2
-
None
Description
--source include/have_partition.inc
|
|
|
CREATE TABLE t1 (a INT) PARTITION BY LIST (a) (PARTITION p0 VALUES IN (1), PARTITION pd DEFAULT); |
INSERT INTO t1 VALUES (1),(2); |
# The row 2 is in pd. After this, it belongs in p2 |
ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (2)); |
--let $c= query_get_value(SELECT COUNT(*) AS c FROM t1 WHERE a=2, c, 1)
|
if ($c != 1) |
{
|
--die The row 2 is not found by a=2 after ADD PARTITION took the value 2 out of the DEFAULT partition |
}
|
|
|
CREATE TABLE t2 (a INT) PARTITION BY LIST (a) (PARTITION p0 VALUES IN (1), PARTITION pd DEFAULT); |
INSERT INTO t2 VALUES (1),(2); |
ALTER TABLE t2 REORGANIZE PARTITION p0 INTO (PARTITION p0 VALUES IN (1), PARTITION p2 VALUES IN (2)); |
--let $c= query_get_value(SELECT COUNT(*) AS c FROM t2 WHERE a=2, c, 1)
|
if ($c != 1) |
{
|
--die The row 2 is not found by a=2 after REORGANIZE PARTITION took the value 2 out of the DEFAULT partition |
}
|
DROP TABLE t1, t2; |
Leads to:
|
CS 13.1.0 da18481158c81ca94689702073c3e04aad85a6a3 (Debug, Clang 22.1.8-20260622) Build 18/08/2026 |
mysqltest: At line 10: The row 2 is not found by a=2 after ADD PARTITION took the value 2 out of the DEFAULT partition
|
Partitioning changes the query result. Without partitioning, a=2 finds the row. After the ADD PARTITION, the row 2 stays in pd and p2 is empty. The t2 part, with REORGANIZE PARTITION, fails in the same way when run on its own. InnoDB and optimized builds give the same result.
From the code it seems that ADD PARTITION for LIST only adds an empty partition. In prep_alter_part_table() in sql/sql_partition.cc, a RANGE table with MAXVALUE refuses ADD PARTITION. A LIST table with a DEFAULT partition refuses it only when the new partition is a DEFAULT partition as well. MDEV-10760 describes a full rebuild of the table for this case.
main.partition_default has the same case. After ADD PARTITION (PARTITION p0 VALUES IN (2,3)), its result file shows 0 rows in p0 and 2 rows in pd.
Attachments
Issue Links
- relates to
-
MDEV-10760 Faster adding PARTITIONs in the table with DEFAULT partition (ALTER TABLE ADD PARTITION)
-
- Open
-
-
MDEV-21042 REORGANIZE PARTITION is not working well on LIST COLUMNS partition type
-
- Confirmed
-
-
MDEV-41598 REORGANIZE PARTITION on a LIST table deletes the rows whose value is no longer in any partition
-
- Open
-