mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV 22785 Crash with prepared statements and NEXTVAL()
The problem was that a PREARE followed by a non prepared statement using DEFAULT NEXT_VALUE() could change table->next_local to point to a not persitent memory aria. The next EXECUTE would then try to use the wrong pointer, which could cause a crash. Fixed by reseting the pointer to it's old value when doing EXECUTE.
This commit is contained in:
@ -185,3 +185,13 @@ ALTER TABLE t1 add column d int default next value for s_not_exits;
|
||||
ERROR 42S02: Table 'test.s_not_exits' doesn't exist
|
||||
drop table t1;
|
||||
drop sequence s1;
|
||||
#
|
||||
# MDEV 22785 Crash with prepared statements and NEXTVAL()
|
||||
#
|
||||
CREATE SEQUENCE s;
|
||||
CREATE TABLE t1 (id int NOT NULL DEFAULT NEXTVAL(s), PRIMARY KEY (id));
|
||||
PREPARE stmt FROM " INSERT INTO t1 () values ()";
|
||||
INSERT INTO t1 () values ();
|
||||
EXECUTE stmt;
|
||||
DROP TABLE t1;
|
||||
DROP SEQUENCE s;
|
||||
|
Reference in New Issue
Block a user