{"action":"created","issue":{"url":"https://api.github.com/repos/drush-ops/drush/issues/1225","labels_url":"https://api.github.com/repos/drush-ops/drush/issues/1225/labels{/name}","comments_url":"https://api.github.com/repos/drush-ops/drush/issues/1225/comments","events_url":"https://api.github.com/repos/drush-ops/drush/issues/1225/events","html_url":"https://github.com/drush-ops/drush/issues/1225","id":59853556,"number":1225,"title":"sql-sanitize command sends SQL query with {} around table names","user":{"login":"rsanzante","id":776453,"avatar_url":"https://avatars.githubusercontent.com/u/776453?v=3","gravatar_id":"","url":"https://api.github.com/users/rsanzante","html_url":"https://github.com/rsanzante","followers_url":"https://api.github.com/users/rsanzante/followers","following_url":"https://api.github.com/users/rsanzante/following{/other_user}","gists_url":"https://api.github.com/users/rsanzante/gists{/gist_id}","starred_url":"https://api.github.com/users/rsanzante/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsanzante/subscriptions","organizations_url":"https://api.github.com/users/rsanzante/orgs","repos_url":"https://api.github.com/users/rsanzante/repos","events_url":"https://api.github.com/users/rsanzante/events{/privacy}","received_events_url":"https://api.github.com/users/rsanzante/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-04T20:05:24Z","updated_at":"2015-03-04T20:25:12Z","closed_at":null,"body":"Using updated drush-7.0-dev I try:\r\n\r\ndrush --debug -vvv sql-sanitize -y\r\n\r\nAnd the relevant part is (with pass value edited):\r\n\r\n>Do you really want to sanitize the current database? (y/n): y\r\nsql-query: UPDATE {users} SET pass = 'XXXXXXXX', mail = concat('user+', uid, '@localhost.localdomain'), init = concat('user+', uid, [status]\r\n'@localhost.localdomain') WHERE uid > 0; TRUNCATE TABLE {sessions};  [0.6 sec, 8.46 MB]\r\nExecuting: mysql --defaults-extra-file=/tmp/drush_fI6TwM --database=gapush --host=localhost --silent  < /tmp/drush_z5cOBe\r\n  ERROR 1064 (42000) at line 1: 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 '} SET pass = 'XXXXXXXX', mail = c' at line 1\r\nReturned from hook drush_sql_sanitize [0.6 sec, 8.46 MB]          \r\n\r\nIt seems that drush is sending to MySQL the query with the brackets around table names. I've edited drush_sql_sanitize() function forcing the $sanitize_query variable to a right SQL query (the same above but without brackets) and then the command works.\r\n\r\nI've tested in several machines with PHP 5.5.12 and 5.4.37 with same result.\r\n\r\nCurrent drush commit is 2c663f095960007984d475e7e3bd7f1a45e5e31b.\r\n"},"comment":{"url":"https://api.github.com/repos/drush-ops/drush/issues/comments/77239614","html_url":"https://github.com/drush-ops/drush/issues/1225#issuecomment-77239614","issue_url":"https://api.github.com/repos/drush-ops/drush/issues/1225","id":77239614,"user":{"login":"rsanzante","id":776453,"avatar_url":"https://avatars.githubusercontent.com/u/776453?v=3","gravatar_id":"","url":"https://api.github.com/users/rsanzante","html_url":"https://github.com/rsanzante","followers_url":"https://api.github.com/users/rsanzante/followers","following_url":"https://api.github.com/users/rsanzante/following{/other_user}","gists_url":"https://api.github.com/users/rsanzante/gists{/gist_id}","starred_url":"https://api.github.com/users/rsanzante/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsanzante/subscriptions","organizations_url":"https://api.github.com/users/rsanzante/orgs","repos_url":"https://api.github.com/users/rsanzante/repos","events_url":"https://api.github.com/users/rsanzante/events{/privacy}","received_events_url":"https://api.github.com/users/rsanzante/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T20:25:12Z","updated_at":"2015-03-04T20:25:12Z","body":"The issue was introduced by this commit:\r\na64d078830b0834ce00d28a2aab2ae92440075b0 - Support db-prefix when running sql-sanitize.\r\n\r\nORevious commit is working ok for me."}}