Skip to content
Permalink
Browse files
MDEV-9020: Connect issues ALTER TABLE DISABLE KEYS when inserting data
If the connecting user doesn't have alter table privilege this isn't
allowed.

This patch removes enable / disable key commands that should never have been here

Closes #2002
  • Loading branch information
splitice authored and grooverdan committed May 27, 2022
1 parent 31e3032 commit c4e87cb
Showing 1 changed file with 0 additions and 19 deletions.
@@ -946,15 +946,6 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)

} // endif MakeInsert

if (m_Rc != RC_FX) {
char cmd[64];
int w;

sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", TableName);

m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines
} // endif m_Rc

} else
// m_Rc = (Mode == MODE_DELETE) ? MakeDelete(g) : MakeUpdate(g);
m_Rc = (MakeCommand(g)) ? RC_FX : RC_OK;
@@ -1216,16 +1207,6 @@ int TDBMYSQL::DeleteDB(PGLOBAL g, int irc)
void TDBMYSQL::CloseDB(PGLOBAL g)
{
if (Myc.Connected()) {
if (Mode == MODE_INSERT) {
char cmd[64];
int w;
PDBUSER dup = PlgGetUser(g);

dup->Step = "Enabling indexes";
sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", TableName);
Myc.m_Rows = -1; // To execute the query
m_Rc = Myc.ExecSQL(g, cmd, &w); // May fail for some engines
} // endif m_Rc

Myc.Close();
} // endif Myc

0 comments on commit c4e87cb

Please sign in to comment.