summaryrefslogtreecommitdiff
path: root/sql/ha_sequence.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-05-02 19:23:00 +0300
committerMonty <monty@mariadb.org>2017-05-08 02:33:34 +0300
commit276b0c8ef03046cc210e4eeab7231cb8d9f16bac (patch)
treed17df40168443e461b10c8e4f9b101a11270e183 /sql/ha_sequence.cc
parentc619fbeafe8d5019e37fcb7ba5e1a6ce2d431270 (diff)
downloadmariadb-git-276b0c8ef03046cc210e4eeab7231cb8d9f16bac.tar.gz
Fixed crash with SEQUENCE when using REPAIR
Diffstat (limited to 'sql/ha_sequence.cc')
-rw-r--r--sql/ha_sequence.cc6
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