{"action":"closed","issue":{"url":"https://api.github.com/repos/CartoDB/CartoDB-SQL-API/issues/274","repository_url":"https://api.github.com/repos/CartoDB/CartoDB-SQL-API","labels_url":"https://api.github.com/repos/CartoDB/CartoDB-SQL-API/issues/274/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/CartoDB-SQL-API/issues/274/comments","events_url":"https://api.github.com/repos/CartoDB/CartoDB-SQL-API/issues/274/events","html_url":"https://github.com/CartoDB/CartoDB-SQL-API/issues/274","id":135476934,"number":274,"title":"Bug: Comments in Editor SQL pane can make correct queries error","user":{"login":"javitonino","id":7569673,"avatar_url":"https://avatars.githubusercontent.com/u/7569673?v=3","gravatar_id":"","url":"https://api.github.com/users/javitonino","html_url":"https://github.com/javitonino","followers_url":"https://api.github.com/users/javitonino/followers","following_url":"https://api.github.com/users/javitonino/following{/other_user}","gists_url":"https://api.github.com/users/javitonino/gists{/gist_id}","starred_url":"https://api.github.com/users/javitonino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javitonino/subscriptions","organizations_url":"https://api.github.com/users/javitonino/orgs","repos_url":"https://api.github.com/users/javitonino/repos","events_url":"https://api.github.com/users/javitonino/events{/privacy}","received_events_url":"https://api.github.com/users/javitonino/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"javitonino","id":7569673,"avatar_url":"https://avatars.githubusercontent.com/u/7569673?v=3","gravatar_id":"","url":"https://api.github.com/users/javitonino","html_url":"https://github.com/javitonino","followers_url":"https://api.github.com/users/javitonino/followers","following_url":"https://api.github.com/users/javitonino/following{/other_user}","gists_url":"https://api.github.com/users/javitonino/gists{/gist_id}","starred_url":"https://api.github.com/users/javitonino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javitonino/subscriptions","organizations_url":"https://api.github.com/users/javitonino/orgs","repos_url":"https://api.github.com/users/javitonino/repos","events_url":"https://api.github.com/users/javitonino/events{/privacy}","received_events_url":"https://api.github.com/users/javitonino/received_events","type":"User","site_admin":false},"assignees":[{"login":"javitonino","id":7569673,"avatar_url":"https://avatars.githubusercontent.com/u/7569673?v=3","gravatar_id":"","url":"https://api.github.com/users/javitonino","html_url":"https://github.com/javitonino","followers_url":"https://api.github.com/users/javitonino/followers","following_url":"https://api.github.com/users/javitonino/following{/other_user}","gists_url":"https://api.github.com/users/javitonino/gists{/gist_id}","starred_url":"https://api.github.com/users/javitonino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javitonino/subscriptions","organizations_url":"https://api.github.com/users/javitonino/orgs","repos_url":"https://api.github.com/users/javitonino/repos","events_url":"https://api.github.com/users/javitonino/events{/privacy}","received_events_url":"https://api.github.com/users/javitonino/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2016-02-22T17:01:50Z","updated_at":"2016-10-26T13:25:41Z","closed_at":"2016-10-26T13:25:41Z","body":"@andrewbt commented on [Thu Jan 07 2016](https://github.com/CartoDB/cartodb/issues/6366)\n\nI was commenting out things and using the SQL pane as a \"scratchpad\", but was getting errors when I tried to run the query and couldn't figure out what was going wrong. Until I got rid of all the comments, then it worked fine.\r\n\r\nOriginal query with comments at the top (including newlines):\r\n\r\n```\r\n-- (MedianState1 * NumberofSalesState1 + MedianState2*NumberofSalesState2 + ... MedianState50*NumberofSalesState50)/TotoalNumberOfSales\r\n-- sum(tinc.totalinc)/totpop.sumhouse as combomedian\r\n--with tinc as (SELECT cartodb_id, (hhi * households) as totalinc FROM athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3), totpop as (select sum(households) as sumhouse from athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3)\r\n--select totpop.sumhouse\r\nselect tinc.totalinc, totpop.sumhouse from (SELECT cartodb_id, (hhi * households) as totalinc FROM athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3) tinc, (select sum(households) as sumhouse from athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3) totpop\r\n```\r\n\r\nQuery that works fine (the functional non comment part) when run by itself:\r\n\r\n```\r\nselect tinc.totalinc, totpop.sumhouse from (SELECT cartodb_id, (hhi * households) as totalinc FROM athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3) tinc, (select sum(households) as sumhouse from athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3) totpop\r\n```\n\n---\n\n@andrewbt commented on [Thu Jan 07 2016](https://github.com/CartoDB/cartodb/issues/6366#issuecomment-169803328)\n\ninterestingly though, this query with just one comment also works correctly without erroring:\r\n\r\n```\r\n-- (MedianState1 * NumberofSalesState1 + MedianState2*NumberofSalesState2 + ... MedianState50*NumberofSalesState50)/TotoalNumberOfSales\r\nselect tinc.totalinc, totpop.sumhouse from (SELECT cartodb_id, (hhi * households) as totalinc FROM athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3) tinc, (select sum(households) as sumhouse from athompson.censustract_1 where cartodb_id = 1 or cartodb_id = 2 or cartodb_id = 3) totpop\r\n```\n\n"}}
{"actor":{"display_login":"javitonino"}}