Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1, 13.2
Description
--source include/have_partition.inc
|
 |
CREATE TABLE t1 (a BIGINT UNSIGNED) PARTITION BY RANGE COLUMNS (a) (PARTITION p0 VALUES LESS THAN (9223372036854775808), PARTITION p1 VALUES LESS THAN (MAXVALUE)); |
--error 0,ER_WRONG_TYPE_COLUMN_VALUE_ERROR
|
INSERT INTO t1 VALUES (1); |
if ($mysql_errno) |
{
|
--die The table was created but cannot be opened: its partition value 9223372036854775808 for a BIGINT UNSIGNED column is refused when the table is opened |
}
|
DROP TABLE t1; |
Leads to:
|
CS 13.1.2 87e62ca17270e163a6d41b3fc8d6f4d440f1bb88 (Debug, Clang 22.1.8-20260622) Build 06/10/2026 |
mysqltest: At line 8: The table was created but cannot be opened: its partition value 9223372036854775808 for a BIGINT UNSIGNED column is refused when the table is opened
|
The CREATE TABLE succeeds. The INSERT, a SELECT and SHOW CREATE TABLE then fail with ERROR 1654 (HY000): Partition column values of incorrect type. Only DROP TABLE works. The table definition holds PARTITION `p0` VALUES LESS THAN (-9223372036854775808). LIST COLUMNS with 18446744073709551615, and an ALTER TABLE ... ADD PARTITION with 9223372036854775808 on a BIGINT UNSIGNED column, give the same result. With 9223372036854775807, with PARTITION BY RANGE (a), and with 3000000000 on an INT UNSIGNED column, the table works. Optimized builds give the same result.
From the code it seems that Type_handler_general_purpose_int::partition_field_append_value() in sql/sql_type.cc writes the value with String::set(longlong), which prints it as signed. When the table is opened, partition_info::fix_column_value_functions() in sql/partition_info.cc stores -9223372036854775808 in the unsigned column, gets a warning and gives ER_WRONG_TYPE_COLUMN_VALUE_ERROR.