Skip to content

Commit 2bf1d08

Browse files
committed
MDEV-37906 Server crash or UBSAN errors in Item_func_nextval::update_table upon INSERT DELAYED
sequences, just as triggers or check constraints, disable DELAYED
1 parent 68432a0 commit 2bf1d08

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

mysql-test/suite/sql_sequence/other.result

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,13 @@ disconnect con1;
385385
connection default;
386386
drop sequence s1;
387387
drop sequence s2;
388-
#
389388
# End of 10.4 tests
390389
#
390+
# MDEV-37906 Server crash or UBSAN errors in Item_func_nextval::update_table upon INSERT DELAYED
391+
#
392+
create sequence s engine=myisam;
393+
create table t (id bigint default(nextval(s))) engine=myisam;
394+
insert delayed into t () values();
395+
drop table t;
396+
drop sequence s;
397+
# End of 10.11 tests

mysql-test/suite/sql_sequence/other.test

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,15 @@ insert into s1 values (1, 1, 10000, 100, 1, 1000, 0, 0);
417417
drop sequence s1;
418418
drop sequence s2;
419419

420-
--echo #
421420
--echo # End of 10.4 tests
421+
422422
--echo #
423+
--echo # MDEV-37906 Server crash or UBSAN errors in Item_func_nextval::update_table upon INSERT DELAYED
424+
--echo #
425+
create sequence s engine=myisam;
426+
create table t (id bigint default(nextval(s))) engine=myisam;
427+
insert delayed into t () values();
428+
drop table t;
429+
drop sequence s;
430+
431+
--echo # End of 10.11 tests

sql/sql_insert.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3406,11 +3406,11 @@ bool Delayed_insert::open_and_lock_table()
34063406
return TRUE;
34073407
}
34083408

3409-
if (table->triggers || table->check_constraints)
3409+
if (table->triggers || table->check_constraints || table->internal_tables)
34103410
{
34113411
/*
3412-
Table has triggers or check constraints. This is not an error, but we do
3413-
not support these with delayed insert. Terminate the delayed
3412+
Table uses triggers, check constraints or sequences. This is not an error,
3413+
but we do not support these with delayed insert. Terminate the delayed
34143414
thread without an error and thus request lock upgrade.
34153415
*/
34163416
return TRUE;

0 commit comments

Comments
 (0)