SQLite to MySQL Database Migration Error because column is named "LocalTimestamp" #41949
Replies: 1 comment 1 reply
|
Enable reserved-word quoting on the target MySQL driver, rather than putting backticks into the column mapping. DBeaver treats the mapping value as an identifier, so manual backticks there are normalized away. The setting is under:
DBeaver documents that option as automatically quoting table/column names when they conflict with reserved SQL keywords: https://dbeaver.com/docs/dbeaver/Driver-Manager/#queries After enabling it, use the plain mapping name If this resolves the question, please mark it as the answer so the working solution is easy for future readers to find. |
Uh oh!
There was an error while loading. Please reload this page.
I was trying to migrate my database from an existing SQLite to another, currently running MySQL database with dbeaver's Export Data tool as written here but kept getting a syntax 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 'LocalTimestamp,[...]' at line 1After trying out the queries myself one by one, I figured out the problem was specifically because of a column was named "LocalTimestamp" which was a reserved keyword for the
LOCALTIMESTAMP()function. So I tried manually adding backtick (`LocalTimestamp`) in the [Costumise ...] setting, but then dbeaver just removes the backticks and the error remains. Adding more backticks forces dbeaver to create a new column instead, which predictably causes an error because the column already exists. Is there a way to force dbeaver to use quotes on the column names? Or some other way to handle this problem?Note:
All reactions