{"action":"created","issue":{"url":"https://api.github.com/repos/markdrago/pgsanity/issues/18","repository_url":"https://api.github.com/repos/markdrago/pgsanity","labels_url":"https://api.github.com/repos/markdrago/pgsanity/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/markdrago/pgsanity/issues/18/comments","events_url":"https://api.github.com/repos/markdrago/pgsanity/issues/18/events","html_url":"https://github.com/markdrago/pgsanity/issues/18","id":192855106,"number":18,"title":"ecpg error on new lines","user":{"login":"yonatan-blue","id":20264096,"avatar_url":"https://avatars.githubusercontent.com/u/20264096?v=3","gravatar_id":"","url":"https://api.github.com/users/yonatan-blue","html_url":"https://github.com/yonatan-blue","followers_url":"https://api.github.com/users/yonatan-blue/followers","following_url":"https://api.github.com/users/yonatan-blue/following{/other_user}","gists_url":"https://api.github.com/users/yonatan-blue/gists{/gist_id}","starred_url":"https://api.github.com/users/yonatan-blue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonatan-blue/subscriptions","organizations_url":"https://api.github.com/users/yonatan-blue/orgs","repos_url":"https://api.github.com/users/yonatan-blue/repos","events_url":"https://api.github.com/users/yonatan-blue/events{/privacy}","received_events_url":"https://api.github.com/users/yonatan-blue/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-12-01T14:03:20Z","updated_at":"2016-12-05T15:46:15Z","closed_at":"2016-12-05T15:46:15Z","body":"on running:  \r\n```\r\nfrom pgsanity.pgsanity import check_string\r\ncheck_string(sql_command)\r\n```\r\nwith a multi-line sql command I get:  \r\n```*** Error in `ecpg': munmap_chunk(): invalid pointer: ***```  \r\nI have found a workaround:\r\n```\r\n  sql_command = '\\n'.join(\r\n        filter(\r\n            lambda line: line.strip() == \"\",\r\n            sql_command.splitlines()\r\n        )\r\n    )\r\n```\r\nmeaning I remove all empty lines.\r\nI tried adding this snippet in: `pgsanity.pgsanity.ecpg.check_syntax` but it broke the tests: \r\n```\r\n  .............................F....F.FF..\r\n======================================================================\r\nFAIL: test_simple_failure (test.test_ecpg.TestEcpg)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/yonatan/github/pgsanity/test/test_ecpg.py\", line 14, in test_simple_failure\r\n    self.assertFalse(success)\r\nAssertionError: True is not false\r\n\r\n======================================================================\r\nFAIL: test_check_invalid_string (test.test_pgsanity.TestPgSanity)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/yonatan/github/pgsanity/test/test_pgsanity.py\", line 34, in test_check_invalid_string\r\n    self.assertFalse(success)\r\nAssertionError: True is not false\r\n\r\n======================================================================\r\nFAIL: test_check_invalid_file (test.test_pgsanity.TestPgSanityFiles)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/yonatan/github/pgsanity/test/test_pgsanity.py\", line 56, in test_check_invalid_file\r\n    self.assertNotEqual(status_code, 0)\r\nAssertionError: 0 == 0\r\n\r\n======================================================================\r\nFAIL: test_check_missing_semi (test.test_pgsanity.TestPgSanityFiles)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/yonatan/github/pgsanity/test/test_pgsanity.py\", line 65, in test_check_missing_semi\r\n    self.assertNotEqual(status_code, 0)\r\nAssertionError: 0 == 0\r\n\r\n----------------------------------------------------------------------\r\nRan 40 tests in 0.020s\r\n\r\nFAILED (failures=4)\r\n```\r\nhow can I fix this?"},"comment":{"url":"https://api.github.com/repos/markdrago/pgsanity/issues/comments/264888641","html_url":"https://github.com/markdrago/pgsanity/issues/18#issuecomment-264888641","issue_url":"https://api.github.com/repos/markdrago/pgsanity/issues/18","id":264888641,"user":{"login":"markdrago","id":34671,"avatar_url":"https://avatars.githubusercontent.com/u/34671?v=3","gravatar_id":"","url":"https://api.github.com/users/markdrago","html_url":"https://github.com/markdrago","followers_url":"https://api.github.com/users/markdrago/followers","following_url":"https://api.github.com/users/markdrago/following{/other_user}","gists_url":"https://api.github.com/users/markdrago/gists{/gist_id}","starred_url":"https://api.github.com/users/markdrago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markdrago/subscriptions","organizations_url":"https://api.github.com/users/markdrago/orgs","repos_url":"https://api.github.com/users/markdrago/repos","events_url":"https://api.github.com/users/markdrago/events{/privacy}","received_events_url":"https://api.github.com/users/markdrago/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T15:46:15Z","updated_at":"2016-12-05T15:46:15Z","body":"I'm running the same version of ecpg that gave you a problem:\r\n\r\n`ecpg (PostgreSQL 9.6.1) 4.12.0`\r\n\r\nI think we'll just hold tight for now and see if anyone else is able to reproduce."}}
{"actor":{"display_login":"markdrago"}}