{"action":"created","issue":{"url":"https://api.github.com/repos/CSNW/sql-bricks/issues/61","labels_url":"https://api.github.com/repos/CSNW/sql-bricks/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/CSNW/sql-bricks/issues/61/comments","events_url":"https://api.github.com/repos/CSNW/sql-bricks/issues/61/events","html_url":"https://github.com/CSNW/sql-bricks/pull/61","id":51209062,"number":61,"title":"Support .where(sql())","user":{"login":"prust","id":23037,"avatar_url":"https://avatars.githubusercontent.com/u/23037?v=3","gravatar_id":"","url":"https://api.github.com/users/prust","html_url":"https://github.com/prust","followers_url":"https://api.github.com/users/prust/followers","following_url":"https://api.github.com/users/prust/following{/other_user}","gists_url":"https://api.github.com/users/prust/gists{/gist_id}","starred_url":"https://api.github.com/users/prust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prust/subscriptions","organizations_url":"https://api.github.com/users/prust/orgs","repos_url":"https://api.github.com/users/prust/repos","events_url":"https://api.github.com/users/prust/events{/privacy}","received_events_url":"https://api.github.com/users/prust/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-12-07T06:24:52Z","updated_at":"2015-08-26T14:14:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CSNW/sql-bricks/pulls/61","html_url":"https://github.com/CSNW/sql-bricks/pull/61","diff_url":"https://github.com/CSNW/sql-bricks/pull/61.diff","patch_url":"https://github.com/CSNW/sql-bricks/pull/61.patch"},"body":"This is an attempt at addressing #60 (and, originally, https://github.com/Suor/sql-bricks-postgres/issues/2).\r\n\r\n@sandfox, @Suor: I tried doing `.where(sql(...))` and it generated `WHERE ... IS NULL`. So I stepped through the code and found that SQL-Bricks supports two WHERE APIs: `.where({key: value})` and `.where(key, value)`. Since an object wasn't passed, sql-bricks thought we were attempting the 2nd API, and since there was no 2nd argument, sql-bricks interpreted it as a null.\r\n\r\nIn 47fc522, I added support for passing a single `sql()` literal. This made my test pass.\r\n\r\n@Suor: In your example, you have parameters being passed to `sql()` as additional arguments.... this would be consistent with the other `.where()` uses, since they allow you to pass parameters -- I probably should add that too, since as it is you have to manually add the parameter values after SQL-Bricks generates the SQL string, but before it gets sent to postgres."},"comment":{"url":"https://api.github.com/repos/CSNW/sql-bricks/issues/comments/135035819","html_url":"https://github.com/CSNW/sql-bricks/pull/61#issuecomment-135035819","issue_url":"https://api.github.com/repos/CSNW/sql-bricks/issues/61","id":135035819,"user":{"login":"prust","id":23037,"avatar_url":"https://avatars.githubusercontent.com/u/23037?v=3","gravatar_id":"","url":"https://api.github.com/users/prust","html_url":"https://github.com/prust","followers_url":"https://api.github.com/users/prust/followers","following_url":"https://api.github.com/users/prust/following{/other_user}","gists_url":"https://api.github.com/users/prust/gists{/gist_id}","starred_url":"https://api.github.com/users/prust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prust/subscriptions","organizations_url":"https://api.github.com/users/prust/orgs","repos_url":"https://api.github.com/users/prust/repos","events_url":"https://api.github.com/users/prust/events{/privacy}","received_events_url":"https://api.github.com/users/prust/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T14:14:50Z","updated_at":"2015-08-26T14:14:50Z","body":"Merging."}}