{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/11242","repository_url":"https://api.github.com/repos/yiisoft/yii2","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/11242/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/11242/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/11242/events","html_url":"https://github.com/yiisoft/yii2/issues/11242","id":144813715,"number":11242,"title":"batchInsert incorrectly quotes SQL query with values, containing {{ }} symbols","user":{"login":"mutyonok","id":87682,"avatar_url":"https://avatars.githubusercontent.com/u/87682?v=3","gravatar_id":"","url":"https://api.github.com/users/mutyonok","html_url":"https://github.com/mutyonok","followers_url":"https://api.github.com/users/mutyonok/followers","following_url":"https://api.github.com/users/mutyonok/following{/other_user}","gists_url":"https://api.github.com/users/mutyonok/gists{/gist_id}","starred_url":"https://api.github.com/users/mutyonok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mutyonok/subscriptions","organizations_url":"https://api.github.com/users/mutyonok/orgs","repos_url":"https://api.github.com/users/mutyonok/repos","events_url":"https://api.github.com/users/mutyonok/events{/privacy}","received_events_url":"https://api.github.com/users/mutyonok/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:under%20discussion","name":"status:under discussion","color":"f7c6c7"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/type:bug","name":"type:bug","color":"e102d8"}],"state":"open","locked":false,"assignee":{"login":"SilverFire","id":4499203,"avatar_url":"https://avatars.githubusercontent.com/u/4499203?v=3","gravatar_id":"","url":"https://api.github.com/users/SilverFire","html_url":"https://github.com/SilverFire","followers_url":"https://api.github.com/users/SilverFire/followers","following_url":"https://api.github.com/users/SilverFire/following{/other_user}","gists_url":"https://api.github.com/users/SilverFire/gists{/gist_id}","starred_url":"https://api.github.com/users/SilverFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SilverFire/subscriptions","organizations_url":"https://api.github.com/users/SilverFire/orgs","repos_url":"https://api.github.com/users/SilverFire/repos","events_url":"https://api.github.com/users/SilverFire/events{/privacy}","received_events_url":"https://api.github.com/users/SilverFire/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/yiisoft/yii2/milestones/17","html_url":"https://github.com/yiisoft/yii2/milestones/2.0.9","labels_url":"https://api.github.com/repos/yiisoft/yii2/milestones/17/labels","id":1580065,"number":17,"title":"2.0.9","description":"","creator":{"login":"cebe","id":189796,"avatar_url":"https://avatars.githubusercontent.com/u/189796?v=3","gravatar_id":"","url":"https://api.github.com/users/cebe","html_url":"https://github.com/cebe","followers_url":"https://api.github.com/users/cebe/followers","following_url":"https://api.github.com/users/cebe/following{/other_user}","gists_url":"https://api.github.com/users/cebe/gists{/gist_id}","starred_url":"https://api.github.com/users/cebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cebe/subscriptions","organizations_url":"https://api.github.com/users/cebe/orgs","repos_url":"https://api.github.com/users/cebe/repos","events_url":"https://api.github.com/users/cebe/events{/privacy}","received_events_url":"https://api.github.com/users/cebe/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":0,"state":"open","created_at":"2016-02-12T16:35:34Z","updated_at":"2016-03-31T11:58:18Z","due_on":"2016-06-18T22:00:00Z","closed_at":null},"comments":10,"created_at":"2016-03-31T07:31:29Z","updated_at":"2016-03-31T15:43:00Z","closed_at":null,"body":"### What steps will reproduce the problem?\r\n`$this->db->createCommand()->batchInsert('table', ['column1'], [[\"input-{{value}}\"]])->execute();`\r\n\r\n### What is the expected result?\r\nValue inserted into a table\r\n### What do you get instead?\r\n[yii\\db\\Exception] SQLSTATE[22P02]: Invalid text representation: 7 ERROR:  invalid input syntax\r\nThe SQL being executed was: `INSERT INTO \"table\" (\"column1\") VALUES ('input-\"value\"')`\r\n\r\n### Additional info\r\nThe problem is that `Command::setSql` method quotes already prepared batch insert query with `'/(\\\\{\\\\{(%?[\\w\\-\\. ]+%?)\\\\}\\\\}|\\\\[\\\\[([\\w\\-\\. ]+)\\\\]\\\\])/'` regexp inside `Connection::quoteSql` which does not know anything about the context \r\n \r\n| Q                | A\r\n| ---------------- | ---\r\n| Yii version      | Yii v2.0.7\r\n| PHP version      | PHP 5.6.16 (cli) (built: Nov 27 2015 10:28:34) \r\n| Operating system | Any\r\n"},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/203991698","html_url":"https://github.com/yiisoft/yii2/issues/11242#issuecomment-203991698","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/11242","id":203991698,"user":{"login":"SilverFire","id":4499203,"avatar_url":"https://avatars.githubusercontent.com/u/4499203?v=3","gravatar_id":"","url":"https://api.github.com/users/SilverFire","html_url":"https://github.com/SilverFire","followers_url":"https://api.github.com/users/SilverFire/followers","following_url":"https://api.github.com/users/SilverFire/following{/other_user}","gists_url":"https://api.github.com/users/SilverFire/gists{/gist_id}","starred_url":"https://api.github.com/users/SilverFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SilverFire/subscriptions","organizations_url":"https://api.github.com/users/SilverFire/orgs","repos_url":"https://api.github.com/users/SilverFire/repos","events_url":"https://api.github.com/users/SilverFire/events{/privacy}","received_events_url":"https://api.github.com/users/SilverFire/received_events","type":"User","site_admin":false},"created_at":"2016-03-31T15:43:00Z","updated_at":"2016-03-31T15:43:00Z","body":"Are you showing method in `Command`, or `QueryBuilder`?"}}