{"action":"created","issue":{"url":"https://api.github.com/repos/awslabs/amazon-redshift-utils/issues/13","labels_url":"https://api.github.com/repos/awslabs/amazon-redshift-utils/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/awslabs/amazon-redshift-utils/issues/13/comments","events_url":"https://api.github.com/repos/awslabs/amazon-redshift-utils/issues/13/events","html_url":"https://github.com/awslabs/amazon-redshift-utils/issues/13","id":65378195,"number":13,"title":"v_space_used_per_tbl gives divide by zero error when encountering table with zero records","user":{"login":"tinkerbotfoo","id":4552152,"avatar_url":"https://avatars.githubusercontent.com/u/4552152?v=3","gravatar_id":"","url":"https://api.github.com/users/tinkerbotfoo","html_url":"https://github.com/tinkerbotfoo","followers_url":"https://api.github.com/users/tinkerbotfoo/followers","following_url":"https://api.github.com/users/tinkerbotfoo/following{/other_user}","gists_url":"https://api.github.com/users/tinkerbotfoo/gists{/gist_id}","starred_url":"https://api.github.com/users/tinkerbotfoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinkerbotfoo/subscriptions","organizations_url":"https://api.github.com/users/tinkerbotfoo/orgs","repos_url":"https://api.github.com/users/tinkerbotfoo/repos","events_url":"https://api.github.com/users/tinkerbotfoo/events{/privacy}","received_events_url":"https://api.github.com/users/tinkerbotfoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-31T06:27:51Z","updated_at":"2015-03-31T07:02:15Z","closed_at":null,"body":"These lines cause the error. Need to handle scenarios where tables can be empty.\t\r\n\r\n\t,ROUND((a.unsorted_rows::FLOAT / a.rows::FLOAT) * 100, 5) AS pct_unsorted\r\n\t\t,CASE WHEN (a.unsorted_rows::FLOAT / a.rows::FLOAT) * 100 >= 20 \r\n\t\t\tTHEN 'VACUUM recommended' ELSE 'n/a' END AS recommendation\r\n\r\nNote: Thanks for publishing these utilities. I have been putting together a similar one but you have done it several times better"},"comment":{"url":"https://api.github.com/repos/awslabs/amazon-redshift-utils/issues/comments/87968624","html_url":"https://github.com/awslabs/amazon-redshift-utils/issues/13#issuecomment-87968624","issue_url":"https://api.github.com/repos/awslabs/amazon-redshift-utils/issues/13","id":87968624,"user":{"login":"tinkerbotfoo","id":4552152,"avatar_url":"https://avatars.githubusercontent.com/u/4552152?v=3","gravatar_id":"","url":"https://api.github.com/users/tinkerbotfoo","html_url":"https://github.com/tinkerbotfoo","followers_url":"https://api.github.com/users/tinkerbotfoo/followers","following_url":"https://api.github.com/users/tinkerbotfoo/following{/other_user}","gists_url":"https://api.github.com/users/tinkerbotfoo/gists{/gist_id}","starred_url":"https://api.github.com/users/tinkerbotfoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinkerbotfoo/subscriptions","organizations_url":"https://api.github.com/users/tinkerbotfoo/orgs","repos_url":"https://api.github.com/users/tinkerbotfoo/repos","events_url":"https://api.github.com/users/tinkerbotfoo/events{/privacy}","received_events_url":"https://api.github.com/users/tinkerbotfoo/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T07:02:15Z","updated_at":"2015-03-31T07:02:15Z","body":"It is a simple fix. I have submitted a pull request. please review."}}