MDEV-24610 MEMORY SE: check overflow in info calls with HA_STATUS_AUTO
This commit is contained in:
parent
266495b93e
commit
c4020b541c
24
mysql-test/suite/parts/r/mdev_24610.result
Normal file
24
mysql-test/suite/parts/r/mdev_24610.result
Normal file
@ -0,0 +1,24 @@
|
||||
CREATE TABLE t (c BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=MEMORY PARTITION BY KEY();
|
||||
INSERT INTO t VALUES (18446744073709551615);
|
||||
select * from t;
|
||||
c
|
||||
18446744073709551615
|
||||
drop table t;
|
||||
CREATE TABLE t (c BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=MEMORY;
|
||||
INSERT INTO t VALUES (18446744073709551615);
|
||||
ALTER TABLE t PARTITION BY KEY();
|
||||
INSERT INTO t VALUES (1);
|
||||
select * from t;
|
||||
c
|
||||
18446744073709551615
|
||||
1
|
||||
drop table t;
|
||||
CREATE TABLE t (c BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=MEMORY;
|
||||
INSERT INTO t VALUES (18446744073709551615);
|
||||
ALTER TABLE t PARTITION BY KEY();
|
||||
INSERT INTO t VALUES (NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
select * from t;
|
||||
c
|
||||
18446744073709551615
|
||||
drop table t;
|
22
mysql-test/suite/parts/t/mdev_24610.test
Normal file
22
mysql-test/suite/parts/t/mdev_24610.test
Normal file
@ -0,0 +1,22 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_partition.inc
|
||||
|
||||
CREATE TABLE t (c BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=MEMORY PARTITION BY KEY();
|
||||
INSERT INTO t VALUES (18446744073709551615);
|
||||
select * from t;
|
||||
drop table t;
|
||||
|
||||
CREATE TABLE t (c BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=MEMORY;
|
||||
INSERT INTO t VALUES (18446744073709551615);
|
||||
ALTER TABLE t PARTITION BY KEY();
|
||||
INSERT INTO t VALUES (1);
|
||||
select * from t;
|
||||
drop table t;
|
||||
|
||||
CREATE TABLE t (c BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE=MEMORY;
|
||||
INSERT INTO t VALUES (18446744073709551615);
|
||||
ALTER TABLE t PARTITION BY KEY();
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
INSERT INTO t VALUES (NULL);
|
||||
select * from t;
|
||||
drop table t;
|
@ -40,6 +40,10 @@ int heap_info(reg1 HP_INFO *info,reg2 HEAPINFO *x, int flag )
|
||||
x->errkey = info->errkey;
|
||||
x->create_time = info->s->create_time;
|
||||
if (flag & HA_STATUS_AUTO)
|
||||
x->auto_increment= info->s->auto_increment + 1;
|
||||
{
|
||||
x->auto_increment= info->s->auto_increment+1;
|
||||
if (!x->auto_increment) /* This shouldn't happen */
|
||||
x->auto_increment= ~(ulonglong) 0;
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
} /* heap_info */
|
||||
|
Loading…
x
Reference in New Issue
Block a user