stergosz
stergosz

Reputation: 5860

can't drop index because its name is an integer

I have some indexes in a table which name is a number(1,2,3,4...)

But when i use the drop command to remove the index i get a 1064 error

DROP INDEX 1 ON table_name;

So my guess is that i cant drop an index when its name is a number? or there is something else i dont know here?

How can it work locally and not on the server?

Error output:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 on table_name' at line 1

Upvotes: 1

Views: 85

Answers (1)

Talya
Talya

Reputation: 19367

Surround 1 with backticks, i.e.

DROP INDEX `1` ON table_name;

Upvotes: 4

Related Questions