{"action":"created","issue":{"url":"https://api.github.com/repos/mfenniak/pg8000/issues/77","labels_url":"https://api.github.com/repos/mfenniak/pg8000/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/mfenniak/pg8000/issues/77/comments","events_url":"https://api.github.com/repos/mfenniak/pg8000/issues/77/events","html_url":"https://github.com/mfenniak/pg8000/issues/77","id":70525267,"number":77,"title":"minor bug in escaping special characters","user":{"login":"xiaolong","id":871574,"avatar_url":"https://avatars.githubusercontent.com/u/871574?v=3","gravatar_id":"","url":"https://api.github.com/users/xiaolong","html_url":"https://github.com/xiaolong","followers_url":"https://api.github.com/users/xiaolong/followers","following_url":"https://api.github.com/users/xiaolong/following{/other_user}","gists_url":"https://api.github.com/users/xiaolong/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaolong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaolong/subscriptions","organizations_url":"https://api.github.com/users/xiaolong/orgs","repos_url":"https://api.github.com/users/xiaolong/repos","events_url":"https://api.github.com/users/xiaolong/events{/privacy}","received_events_url":"https://api.github.com/users/xiaolong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-23T22:09:40Z","updated_at":"2015-04-24T01:58:16Z","closed_at":null,"body":"The issue is when I tried to execute a statement that contains `%` within a string, I got the following error:\r\n\r\n    '% ' not supported in a quoted string within the query string\r\n\r\nThe SQL statement I was trying to execute is:\r\n    \r\n    INSERT INTO events(event_type) VALUES ('cars 50% saved');\r\n\r\nand this is the Python code segment that fails:\r\n\r\n    query = 'insert into events(event_type) values (\\'%s\\');' % ('cars 50% saved')\r\n    cursor.execute(query)\r\n\r\nIf I replace `%` with `%%`, it succeeds ---which is weird.\r\n\r\nI briefly look at [this line](https://github.com/mfenniak/pg8000/blob/master/pg8000/core.py#L529), and it seems like only 2 consecutive percent sign (`%%`) is treated as percent sign, while a single percent sign (`%`) will throw an exception.  Is there a specific reason to do this? I mean, single percent sign works totally fine with `psql` or GUI tools like `pgAdmin` or `Navicat`.\r\n\r\n------------\r\nEdit:\r\nI do realize that I can do it with:\r\n\r\n    cursor.execute(\"insert into events(event_type) values (%s); \", (\"cars 50% saved\",))\r\n\r\nbut there is no compelling reason that the previous code should fail."},"comment":{"url":"https://api.github.com/repos/mfenniak/pg8000/issues/comments/95773394","html_url":"https://github.com/mfenniak/pg8000/issues/77#issuecomment-95773394","issue_url":"https://api.github.com/repos/mfenniak/pg8000/issues/77","id":95773394,"user":{"login":"mfenniak","id":91093,"avatar_url":"https://avatars.githubusercontent.com/u/91093?v=3","gravatar_id":"","url":"https://api.github.com/users/mfenniak","html_url":"https://github.com/mfenniak","followers_url":"https://api.github.com/users/mfenniak/followers","following_url":"https://api.github.com/users/mfenniak/following{/other_user}","gists_url":"https://api.github.com/users/mfenniak/gists{/gist_id}","starred_url":"https://api.github.com/users/mfenniak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfenniak/subscriptions","organizations_url":"https://api.github.com/users/mfenniak/orgs","repos_url":"https://api.github.com/users/mfenniak/repos","events_url":"https://api.github.com/users/mfenniak/events{/privacy}","received_events_url":"https://api.github.com/users/mfenniak/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T01:58:16Z","updated_at":"2015-04-24T01:58:16Z","body":"Hi @xiaolong, thanks for the bug report.  I'd say this looks like an issue; I'm guessing that if you used %% it would work.  The driver is probably trying to do query formatting here even though you haven't provided any parameters to substitute into the query.\r\n\r\nSince there's a workaround possible, I think we won't be jumping on this issue as a really urgent issue that needs to be fixed.  But I still really appreciate the bug report. :-)  Thank-you, and, this issue will get addressed."}}