diff options
author | Monty <monty@mariadb.org> | 2017-05-02 19:23:00 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-05-08 02:33:34 +0300 |
commit | 276b0c8ef03046cc210e4eeab7231cb8d9f16bac (patch) | |
tree | d17df40168443e461b10c8e4f9b101a11270e183 /sql/ha_sequence.cc | |
parent | c619fbeafe8d5019e37fcb7ba5e1a6ce2d431270 (diff) | |
download | mariadb-git-276b0c8ef03046cc210e4eeab7231cb8d9f16bac.tar.gz |
Fixed crash with SEQUENCE when using REPAIR
Diffstat (limited to 'sql/ha_sequence.cc')
-rw-r--r-- | sql/ha_sequence.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 25a1a6e71c4..5ff5a4eb213 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -110,6 +110,8 @@ int ha_sequence::open(const char *name, int mode, uint flags) if ((error= table->s->sequence->read_initial_values(table))) file->ha_close(); } + else + table->m_needs_reopen= true; } DBUG_RETURN(error); } @@ -189,11 +191,13 @@ int ha_sequence::write_row(uchar *buf) DBUG_ASSERT(table->record[0] == buf); row_already_logged= 0; - if (!sequence->initialized) + if (unlikely(sequence->initialized == SEQUENCE::SEQ_IN_PREPARE)) { /* This calls is from ha_open() as part of create table */ DBUG_RETURN(file->write_row(buf)); } + if (unlikely(sequence->initialized != SEQUENCE::SEQ_READY_TO_USE)) + DBUG_RETURN(HA_ERR_WRONG_COMMAND); /* User tries to write a row |