mirror of
https://github.com/DBDiff/DBDiff.git
synced 2026-04-25 05:15:49 +03:00
[GH-ISSUE #120] PHP Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; #224
Labels
No labels
bug
enhancement
good first issue
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/DBDiff#224
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Aquive on GitHub (Apr 12, 2021).
Original GitHub issue: https://github.com/DBDiff/DBDiff/issues/120
Hi, I get below error on --type=data or all. --type=schema works as expected. How can I solve it?
pp@6bb82a2c0270:~/DBDiff$ ./dbdiff server1.small:server2.stage-small --type=data
ℹ Now calculating data diff for table
admin_rule✖ Unexpected error: SQLSTATE[42000]: Syntax error or access violation: 1064 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 '-small.admin_rule as a
LEFT JOIN kp-stage-small.admin_rule as b ON
' at line 1 (SQL: SELECT CONVERT(a.rule_idUSING utf8) asrule_id,CONVERT(a.role_idUSING utf8) asrole_id,CONVERT(a.resource_idUSING utf8) asresource_id,CONVERT(a.privilegesUSING utf8) asprivileges,CONVERT(a.assert_idUSING utf8) asassert_id,CONVERT(a.role_typeUSING utf8) asrole_type,CONVERT(a.permissionUSING utf8) aspermissionFROM kp-small.admin_rule as a LEFT JOIN kp-stage-small.admin_rule as b ONa.rule_id=b.rule_idWHEREb.rule_idIS NULL ) PHP Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 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 '-small.admin_rule as a LEFT JOIN kp-stage-small.admin_rule as b ON' at line 1 in /data/web/DBDiff/vendor/illuminate/database/Illuminate/Database/Connection.php:299Stack trace:
#0 /data/web/DBDiff/vendor/illuminate/database/Illuminate/Database/Connection.php(299): PDO->prepare('SELECT CONVERT(...')
#1 /data/web/DBDiff/vendor/illuminate/database/Illuminate/Database/Connection.php(617): Illuminate\Database\Connection->Illuminate\Database{closure}(Object(Illuminate\Database\MySqlConnection), 'SELECT CONVERT(...', Array)
#2 /data/web/DBDiff/vendor/illuminate/database/Illuminate/Database/Connection.php(581): Illuminate\Database\Connection->runQueryCallback('SELECT CONVERT(...', Array, Object(Closure))
#3 /data/web/DBDiff/vendor/illuminate/database/Illuminate/Database/Connection.php(304): I in /data/web/DBDiff/vendor/illuminate/database/Illuminate/Database/Connection.php on line 625
@rzroth commented on GitHub (Jun 10, 2022):
There is a flaw in DBDiff that doesn't account for tables with '-' in the name, because it tries to make a illegally named JOIN
Still working on my cases, I suspect you will need to rename the database
In my case, it is only tables with '-' in the name
I'm looking into the code to see how that might addresssed