{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/4904","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/4904/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4904/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/4904/events","html_url":"https://github.com/sequelize/sequelize/issues/4904","id":118242171,"number":4904,"title":"findAll raw where caluse with in and array replacements results in wrong query","user":{"login":"umar-muneer","id":9190305,"avatar_url":"https://avatars.githubusercontent.com/u/9190305?v=3","gravatar_id":"","url":"https://api.github.com/users/umar-muneer","html_url":"https://github.com/umar-muneer","followers_url":"https://api.github.com/users/umar-muneer/followers","following_url":"https://api.github.com/users/umar-muneer/following{/other_user}","gists_url":"https://api.github.com/users/umar-muneer/gists{/gist_id}","starred_url":"https://api.github.com/users/umar-muneer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/umar-muneer/subscriptions","organizations_url":"https://api.github.com/users/umar-muneer/orgs","repos_url":"https://api.github.com/users/umar-muneer/repos","events_url":"https://api.github.com/users/umar-muneer/events{/privacy}","received_events_url":"https://api.github.com/users/umar-muneer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sequelize/sequelize/labels/bug","name":"bug","color":"d7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-22T05:53:19Z","updated_at":"2015-11-27T05:40:55Z","closed_at":null,"body":"I am using sequelize 3.14.1 with mysql and the following code fragment;\r\n\r\n```javascript\r\nvar A = sequelize.define(\"A\",{\r\n\t\"id\":{type:Sequelize.INTEGER,primaryKey:true,allowNull:false,autoIncrement:true},\r\n\t\"name\":Sequelize.STRING\r\n});\r\n\r\nvar B = sequelize.define(\"B\",{\r\n\t\"id\":{type:Sequelize.INTEGER,primaryKey:true,allowNull:false,autoIncrement:true},\r\n\t\"aId\":Sequelize.INTEGER,\r\n\t\"detail\":Sequelize.STRING\r\n});\r\nA.hasMany(B,{\"foreignKey\":'aId'});\r\nreturn Promise.bind({}).then(function(){\r\n\treturn sequelize.sync({\r\n\t\t\"force\":true\r\n\t});\r\n}).then(function(){\r\n\treturn A.create({\r\n\t\t\"name\":\"test1\"\r\n\t});\r\n}).then(function(result){\r\n\treturn B.bulkCreate([{\"aId\":result.id,\"detail\":\"detail1\"},{\"aId\":result.id,\"detail\":\"detail2\"}]);\r\n}).then(function(){\r\n\treturn A.findAll({\r\n\t\t\"include\":[{\r\n\t\t\t\"model\":B,\r\n\t\t\t\"where\":['aId not in (?)',[10,11]]\r\n\t\t}]\r\n\t});\r\n}); \r\n```\r\nthe find All call results in the following query \r\n\r\n> SELECT `A`.`id`, `A`.`name`, `A`.`createdAt`, `A`.`updatedAt`, `Bs`.`id` AS `Bs.id`, `Bs`.`aId` AS `Bs.aId`, `Bs`.`detail` AS `Bs.detail`, `Bs`.`createdAt` AS `Bs.createdAt`, `Bs`.`updatedAt` AS `Bs.updatedAt` FROM `As` AS `A` INNER JOIN `Bs` AS `Bs` ON `A`.`id` = `Bs`.`aId` AND aId not in ([10,11]);\r\n\r\nthis query results in the following error\r\n>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 '[10,11])' at line 1\r\n\r\nHowever if i revert to 3.12 and run the same code fragment it runs without an error and generates the correct query\r\n\r\n>SELECT `A`.`id`, `A`.`name`, `A`.`createdAt`, `A`.`updatedAt`, `Bs`.`id` AS `Bs.id`, `Bs`.`aId` AS `Bs.aId`, `Bs`.`detail` AS `Bs.detail`, `Bs`.`createdAt` AS `Bs.createdAt`, `Bs`.`updatedAt` AS `Bs.updatedAt` FROM `As` AS `A` INNER JOIN `Bs` AS `Bs` ON `A`.`id` = `Bs`.`aId` AND aId not in (10, 11);\r\n\r\nI have gone through the change log for versions 3.13 and 3.14 but i couldn't find any related information.\r\n"},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/160047924","html_url":"https://github.com/sequelize/sequelize/issues/4904#issuecomment-160047924","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/4904","id":160047924,"user":{"login":"NewGyu","id":1220522,"avatar_url":"https://avatars.githubusercontent.com/u/1220522?v=3","gravatar_id":"","url":"https://api.github.com/users/NewGyu","html_url":"https://github.com/NewGyu","followers_url":"https://api.github.com/users/NewGyu/followers","following_url":"https://api.github.com/users/NewGyu/following{/other_user}","gists_url":"https://api.github.com/users/NewGyu/gists{/gist_id}","starred_url":"https://api.github.com/users/NewGyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NewGyu/subscriptions","organizations_url":"https://api.github.com/users/NewGyu/orgs","repos_url":"https://api.github.com/users/NewGyu/repos","events_url":"https://api.github.com/users/NewGyu/events{/privacy}","received_events_url":"https://api.github.com/users/NewGyu/received_events","type":"User","site_admin":false},"created_at":"2015-11-27T05:40:55Z","updated_at":"2015-11-27T05:40:55Z","body":":+1: "}}