From e27bfeca6a0fb83047472470c56742b15f6bc0c0 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Fri, 6 Apr 2018 12:31:13 +0300 Subject: [PATCH] Added test case for MDEV-15742 to prove that it works MDEV-15742 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed in handler::ha_write_row --- mysql-test/suite/sql_sequence/lock.result | 10 ++++++++++ mysql-test/suite/sql_sequence/lock.test | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/mysql-test/suite/sql_sequence/lock.result b/mysql-test/suite/sql_sequence/lock.result index a3bde97d3a3..05a06b218b3 100644 --- a/mysql-test/suite/sql_sequence/lock.result +++ b/mysql-test/suite/sql_sequence/lock.result @@ -17,3 +17,13 @@ a select * from t2; a drop tables s1, t1, t2; +CREATE SEQUENCE s1; +LOCK TABLE s1 READ; +SELECT NEXTVAL(s1); +ERROR HY000: Table 's1' was locked with a READ lock and can't be updated +SELECT NEXTVAL(s); +ERROR HY000: Table 's' was not locked with LOCK TABLES +DROP SEQUENCE s1; +ERROR HY000: Table 's1' was locked with a READ lock and can't be updated +unlock tables; +DROP SEQUENCE s1; diff --git a/mysql-test/suite/sql_sequence/lock.test b/mysql-test/suite/sql_sequence/lock.test index caa8843bb54..2208a1f1ffa 100644 --- a/mysql-test/suite/sql_sequence/lock.test +++ b/mysql-test/suite/sql_sequence/lock.test @@ -22,3 +22,19 @@ unlock tables; select * from t1; select * from t2; drop tables s1, t1, t2; + +# +# MDEV-15742 Assertion `table_share->tmp_table != NO_TMP_TABLE || +# m_lock_type == 1' failed in handler::ha_write_row +# + +CREATE SEQUENCE s1; +LOCK TABLE s1 READ; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +SELECT NEXTVAL(s1); +--error ER_TABLE_NOT_LOCKED +SELECT NEXTVAL(s); +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +DROP SEQUENCE s1; +unlock tables; +DROP SEQUENCE s1;