{"action":"created","issue":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/3011","labels_url":"https://api.github.com/repos/sequelize/sequelize/issues/3011/labels{/name}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/3011/comments","events_url":"https://api.github.com/repos/sequelize/sequelize/issues/3011/events","html_url":"https://github.com/sequelize/sequelize/issues/3011","id":55622323,"number":3011,"title":"DBERROR : Schema \"Table\" not found when using RC7+ of sequelize using postgreSQL, postgreSQL schemas,  and \"include\" feature on findAll ","user":{"login":"josdewitte","id":3986164,"avatar_url":"https://avatars.githubusercontent.com/u/3986164?v=3","gravatar_id":"","url":"https://api.github.com/users/josdewitte","html_url":"https://github.com/josdewitte","followers_url":"https://api.github.com/users/josdewitte/followers","following_url":"https://api.github.com/users/josdewitte/following{/other_user}","gists_url":"https://api.github.com/users/josdewitte/gists{/gist_id}","starred_url":"https://api.github.com/users/josdewitte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josdewitte/subscriptions","organizations_url":"https://api.github.com/users/josdewitte/orgs","repos_url":"https://api.github.com/users/josdewitte/repos","events_url":"https://api.github.com/users/josdewitte/events{/privacy}","received_events_url":"https://api.github.com/users/josdewitte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-27T14:13:48Z","updated_at":"2015-01-27T15:02:44Z","closed_at":null,"body":"Using findAll on a model with postgres schema name and underscored table name, and using the \"include\" feature on this findAll statement results in incorrect SQL, since the \"AS [modelInstanceName]\" cannot be used in the SELECT query at the same time.\r\n  "},"comment":{"url":"https://api.github.com/repos/sequelize/sequelize/issues/comments/71661712","html_url":"https://github.com/sequelize/sequelize/issues/3011#issuecomment-71661712","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/3011","id":71661712,"user":{"login":"josdewitte","id":3986164,"avatar_url":"https://avatars.githubusercontent.com/u/3986164?v=3","gravatar_id":"","url":"https://api.github.com/users/josdewitte","html_url":"https://github.com/josdewitte","followers_url":"https://api.github.com/users/josdewitte/followers","following_url":"https://api.github.com/users/josdewitte/following{/other_user}","gists_url":"https://api.github.com/users/josdewitte/gists{/gist_id}","starred_url":"https://api.github.com/users/josdewitte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josdewitte/subscriptions","organizations_url":"https://api.github.com/users/josdewitte/orgs","repos_url":"https://api.github.com/users/josdewitte/repos","events_url":"https://api.github.com/users/josdewitte/events{/privacy}","received_events_url":"https://api.github.com/users/josdewitte/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T15:02:44Z","updated_at":"2015-01-27T15:02:44Z","body":"In pre-RC7, i could include for example many-to-one B and order by \"B.index\"; \r\n\r\nactual code:\r\n\r\n self.model.Route.findAll({where:{id > 0}, include: [{ model: self.model.Sector, as:'sector'}], order: [['sector.index','ASC'],['number','ASC']] });\r\n\r\nHowever the \"Route\" table alias in the SQL query now creates \"Route\".\"sector\".\"index\"\r\n\r\n\r\n"}}