Bug #110144 CREATE TABLE with a large MIN_ROWS on an indexed column causes memory error.
Submitted: 21 Feb 2023 2:16 Modified: 21 Feb 2023 14:16
Reporter: John Jove Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:8.0.32 OS:Any
Assigned to: CPU Architecture:Any

[21 Feb 2023 2:16] John Jove
Description:
I first execute a CREATE TABLE with a large MIN_ROWS, which creates a table with an indexed column. And then I create another table with the same structure of this table. I finally query on these two tables, An unexpected memory error happens.

By the way, when I remove all indexes from tables, no memory error happens.

How to repeat:
Run the following statements, the SELECT statement will report a memory error.

CREATE TABLE t0(c0 INT UNIQUE KEY) MIN_ROWS = 7837978743245037283;
CREATE TABLE IF NOT EXISTS t1 LIKE t0;
INSERT INTO t1(c0) VALUES(1);

SELECT ALL * FROM t1, t0 WHERE NOT (t1.c0) >= (t0.c0); -- [HY000][34] Memory capacity exceeded (capacity 8388608 bytes)

However, when I remove the UNIQUE KEY for column c0, the memory error is gone.

CREATE TABLE t0(c0 INT) MIN_ROWS = 7837978743245037283;
CREATE TABLE IF NOT EXISTS t1 LIKE t0;
INSERT INTO t1(c0) VALUES(1);

SELECT ALL * FROM t1, t0 WHERE NOT (t1.c0) >= (t0.c0); -- no errors
[21 Feb 2023 2:20] John Jove
When remove the option `MIN_ROWS = 7837978743245037283` for the CREATE TABLE statement, the bug still exists.
[21 Feb 2023 14:16] MySQL Verification Team
Hi Mr. Jove,

Thank you for your bug report.

However , it is not a bug.

Simply, the datatype of INT that you used can accommodate much smaller number of rows then the number of MIN_ROWS that you described.

We ran tests on the tables , without MIN_ROWS with 8.0.32 and had no problems what so ever.

This is simply not a bug.