Bug #104819 partition table maxvalue define error
Submitted: 3 Sep 2021 6:55 Modified: 3 Sep 2021 12:12
Reporter: Boy Zhang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: Partition MAXVALUE UNSIGNED

[3 Sep 2021 6:55] Boy Zhang
Description:
When I define a partition with a boundary value greater than LLONG_MAX (9223372036854775807) in the range partitioning, I cannot define the MAXVALUE partition.

How to repeat:

mysql->CREATE TABLE test(id BIGINT UNSIGNED, k INT) PARTITION BY RANGE(id) (PARTITION p0 VALUES LESS THAN(1), PARTITION p1 VALUES LESS THAN(9223372036854775808));

mysql->ALTER TABLE test ADD PARTITION (PARTITION p2 VALUES LESS THAN(MAXVALUE));

ERROR 1493 (HY000): VALUES LESS THAN value must be strictly increasing for each partition

Suggested fix:
When fixing partition values, distinguish between unsigned and unsigned. When the part field is unsigned, the range value should be assigned ULLONG_MAX instead of LLONG_MAX.
[3 Sep 2021 12:12] MySQL Verification Team
Hi Mr. Zhang,

Thank you for your bug report.

We have tested your example statements on the latest 8.0 and we agree that this is a bug. Simply, MAXVALUE does not honour fully the type that it is referring to.

Verified as reported.