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:
@ -123,3 +123,15 @@ ALTER TABLE t1 add column c int;
|
||||
ALTER TABLE t1 add column d int default next value for s_not_exits;
|
||||
drop table t1;
|
||||
drop sequence s1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV 22785 Crash with prepared statements and NEXTVAL()
|
||||
--echo #
|
||||
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;
|
||||
# Cleanup
|
||||
DROP TABLE t1;
|
||||
DROP SEQUENCE s;
|
||||
|
Reference in New Issue
Block a user