This article mainly introduces the errors that occur when the savepoint statement in MySQL is used. The problems that occur when the string is eare also submitted as a MySQL bug, if you need a friend, you can refer to the case to help your colleagues solve the problem in the next few days. in the master-slave replication environment, the MySQL version number on the slave database is 5.5.5, and the following error occurs:
# Other non-related information I have hidden [(yejr@imysql.com)]> show slave status \ G; Slave_IO_Running: Yes Slave_ SQL _Running: No Last_Errno: 1064 Last_Error: error '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 '6e86db84 _ 14847168f19 _ 8000 'at line 1' on query. default database: 'Act '. query: 'savepoint Partition _ 8000 'Last_IO_Errno: 0 Last_IO_Error: Last_ SQL _Errno: 1064 Last_ SQL _Error: error' 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 '6e86db84 _ 14847168f19 _ 8000 'at line 1' on query. default database: 'Act _ log '. query: 'savepoint 6e86db84_14847168f19 _ 8080'
The first thought is to encounter reserved keywords. However, if you see such a long string, it should not be reserved keywords.
After trying, we finally found that if the character "e" in the string exists, an error may be reported, which seems to be a bug.
This bug is indeed found in the MySQL bug system, but according to the bug description, it should have been fixed in version 5.5. it seems that it is too unreliable ~~
About this bug: Savepoint identifier is occasionally considered as floating point numbers
In fact, in addition to the upgraded version, the solution is also very simple. just reference the identifier string after the savepoint with backquotes (the lower key of the tilde, called the backticks key in English.
For example:
savepoint `6e86db84_14847168f19__8000`;
In this way, you can.
This case also reminds us that when writing SQL statements involving names such as databases, tables, fields, and identifier, it is best to use reverse quotation marks to ensure availability.
I have seen that the field name of an online data table is check. this name has long been reserved as a keyword in MySQL. Fortunately, developers are more reliable and have added backticks.
Two bugs about savepoint:
Savepoint Identifier shocould be enclosed with backticks
Savepoint identifier is occasionally considered as floating point numbers