summaryrefslogtreecommitdiff
path: root/sql/sql_sequence.cc
diff options
context:
space:
mode:
authorRobert Bindar <robert@mariadb.org>2019-04-16 17:52:31 +0300
committerRobert Bindar <robert@mariadb.org>2019-12-02 13:43:16 +0200
commit8d2a57b4b7b9f6c7894ebf285a5c390e40fdc806 (patch)
treecdee957ad8962c04c3ada97410339da0182fbd74 /sql/sql_sequence.cc
parent7e917bba5d8318765ae3074bcb7c2634ea84ab45 (diff)
downloadmariadb-git-8d2a57b4b7b9f6c7894ebf285a5c390e40fdc806.tar.gz
MDEV-15977 Assertion !thd->in_sub_stmt failed in trans_commit_stmt
Diffstat (limited to 'sql/sql_sequence.cc')
-rw-r--r--sql/sql_sequence.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index a7b5def9193..b69b52505f4 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -487,9 +487,12 @@ int SEQUENCE::read_initial_values(TABLE *table)
Doing mysql_lock_tables() may have started a read only transaction.
If that happend, it's better that we commit it now, as a lot of
code assumes that there is no active stmt transaction directly after
- open_tables()
+ open_tables().
+ But we also don't want to commit the stmt transaction while in a
+ substatement, see MDEV-15977.
*/
- if (!has_active_transaction && !thd->transaction.stmt.is_empty())
+ if (!has_active_transaction && !thd->transaction.stmt.is_empty() &&
+ !thd->in_sub_stmt)
trans_commit_stmt(thd);
}
write_unlock(table);