{"action":"created","issue":{"url":"https://api.github.com/repos/robconery/massive-js/issues/26","labels_url":"https://api.github.com/repos/robconery/massive-js/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/robconery/massive-js/issues/26/comments","events_url":"https://api.github.com/repos/robconery/massive-js/issues/26/events","html_url":"https://github.com/robconery/massive-js/issues/26","id":59945417,"number":26,"title":"Inconsistent double quote escaping","user":{"login":"Sharkwald","id":120232,"avatar_url":"https://avatars.githubusercontent.com/u/120232?v=3","gravatar_id":"","url":"https://api.github.com/users/Sharkwald","html_url":"https://github.com/Sharkwald","followers_url":"https://api.github.com/users/Sharkwald/followers","following_url":"https://api.github.com/users/Sharkwald/following{/other_user}","gists_url":"https://api.github.com/users/Sharkwald/gists{/gist_id}","starred_url":"https://api.github.com/users/Sharkwald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sharkwald/subscriptions","organizations_url":"https://api.github.com/users/Sharkwald/orgs","repos_url":"https://api.github.com/users/Sharkwald/repos","events_url":"https://api.github.com/users/Sharkwald/events{/privacy}","received_events_url":"https://api.github.com/users/Sharkwald/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-03-05T12:31:45Z","updated_at":"2015-03-09T11:55:21Z","closed_at":null,"body":"When using CamelCased DB object names, there are a number of instances where the SQL generated is not double quote escaped, causing errors to be thrown.\r\n\r\nFor example, using [Chinook](https://chinookdatabase.codeplex.com/):\r\n```\r\ndb > db.Artist.findOne(1, function(err, result) { console.log(err); });\r\nundefined\r\ndb > { [error: relation \"artist\" does not exist]\r\n```\r\nPlaces where I've found this issue so far are the table name, the columns and the default order by (i.e. the pk).\r\n\r\nI'm not sure whether to include the custom order by, since it's a supplied string, so the delimiting could be placed in the calling code. On the one hand that feels like a potential gotcha, on the other hand, the whole point is to take advantage of postgres' sql engine, which means playing by its rules.\r\n\r\nI think I should have a fix for this ready for a PR soon, but I want to ensure it's properly tested first.\r\n\r\nPS: This is the first time I've raised an issue & worked on the fix, so please be gentle!"},"comment":{"url":"https://api.github.com/repos/robconery/massive-js/issues/comments/77840547","html_url":"https://github.com/robconery/massive-js/issues/26#issuecomment-77840547","issue_url":"https://api.github.com/repos/robconery/massive-js/issues/26","id":77840547,"user":{"login":"xivSolutions","id":853147,"avatar_url":"https://avatars.githubusercontent.com/u/853147?v=3","gravatar_id":"","url":"https://api.github.com/users/xivSolutions","html_url":"https://github.com/xivSolutions","followers_url":"https://api.github.com/users/xivSolutions/followers","following_url":"https://api.github.com/users/xivSolutions/following{/other_user}","gists_url":"https://api.github.com/users/xivSolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/xivSolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xivSolutions/subscriptions","organizations_url":"https://api.github.com/users/xivSolutions/orgs","repos_url":"https://api.github.com/users/xivSolutions/repos","events_url":"https://api.github.com/users/xivSolutions/events{/privacy}","received_events_url":"https://api.github.com/users/xivSolutions/received_events","type":"User","site_admin":false},"created_at":"2015-03-09T11:55:21Z","updated_at":"2015-03-09T11:55:21Z","body":"The issue @Sharkwald was describing is when you have a *backend* with cased database objects. This does create a problem. \r\n\r\nProper casing on js objects, I agree isn't much of a problem. Looks to me like he pulled down the default chinook pg db, which is all proper-cased in the db itself. The version of Chinook you were using in here previously (and in Biggy) previously I had modified for pg to use compatible (lower-cased/underscored) names. \r\n\r\nMy question was whether we want to support databases with non-standard casing in the back end. \r\n\r\nI'm inclined to say we shouldn't, and encourage folks to adhere to pg standards. "}}