{"action":"created","issue":{"url":"https://api.github.com/repos/lib/pq/issues/708","repository_url":"https://api.github.com/repos/lib/pq","labels_url":"https://api.github.com/repos/lib/pq/issues/708/labels{/name}","comments_url":"https://api.github.com/repos/lib/pq/issues/708/comments","events_url":"https://api.github.com/repos/lib/pq/issues/708/events","html_url":"https://github.com/lib/pq/issues/708","id":294075835,"number":708,"title":"Not escaping string in an alter password command","user":{"login":"b-ryan","id":1183997,"avatar_url":"https://avatars1.githubusercontent.com/u/1183997?v=4","gravatar_id":"","url":"https://api.github.com/users/b-ryan","html_url":"https://github.com/b-ryan","followers_url":"https://api.github.com/users/b-ryan/followers","following_url":"https://api.github.com/users/b-ryan/following{/other_user}","gists_url":"https://api.github.com/users/b-ryan/gists{/gist_id}","starred_url":"https://api.github.com/users/b-ryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b-ryan/subscriptions","organizations_url":"https://api.github.com/users/b-ryan/orgs","repos_url":"https://api.github.com/users/b-ryan/repos","events_url":"https://api.github.com/users/b-ryan/events{/privacy}","received_events_url":"https://api.github.com/users/b-ryan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-03T02:31:15Z","updated_at":"2018-02-03T14:45:48Z","closed_at":null,"author_association":"NONE","body":"I am trying to run an alter user command with a dynamic password. code:\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"database/sql\"\r\n\t\"log\"\r\n\r\n\t_ \"github.com/lib/pq\"\r\n)\r\n\r\nfunc main() {\r\n\tconnStr := \"user=buck password=password dbname=buck sslmode=disable\"\r\n\tdb, err := sql.Open(\"postgres\", connStr)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\tnewPassword := \"newpassword\"\r\n\t_, err = db.Query(\"ALTER USER buck WITH ENCRYPTED PASSWORD $1\", newPassword)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n}\r\n```\r\n\r\nfails with\r\n\r\n```\r\n2018/02/02 21:26:56 pq: syntax error at or near \"$1\"\r\n```\r\n\r\nNow I know that at least one issue like this was opened: https://github.com/lib/pq/issues/694 but I had thought this issue would only affect identifiers. I know I have been able to bind strings in this statement in Python, but that could have also been the library helping out.\r\n\r\nSo my question is whether this is the same as #694 and if it is, is there any way for me to get around it other than just writing my own escaping function?"},"comment":{"url":"https://api.github.com/repos/lib/pq/issues/comments/362816437","html_url":"https://github.com/lib/pq/issues/708#issuecomment-362816437","issue_url":"https://api.github.com/repos/lib/pq/issues/708","id":362816437,"user":{"login":"cbandy","id":106560,"avatar_url":"https://avatars0.githubusercontent.com/u/106560?v=4","gravatar_id":"","url":"https://api.github.com/users/cbandy","html_url":"https://github.com/cbandy","followers_url":"https://api.github.com/users/cbandy/followers","following_url":"https://api.github.com/users/cbandy/following{/other_user}","gists_url":"https://api.github.com/users/cbandy/gists{/gist_id}","starred_url":"https://api.github.com/users/cbandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbandy/subscriptions","organizations_url":"https://api.github.com/users/cbandy/orgs","repos_url":"https://api.github.com/users/cbandy/repos","events_url":"https://api.github.com/users/cbandy/events{/privacy}","received_events_url":"https://api.github.com/users/cbandy/received_events","type":"User","site_admin":false},"created_at":"2018-02-03T14:45:48Z","updated_at":"2018-02-03T14:45:48Z","author_association":"CONTRIBUTOR","body":"Correct, only statements that can be `PREPARE`d will accept placeholders."}}
{"actor":{"display_login":"cbandy"}}