{"action":"created","issue":{"url":"https://api.github.com/repos/tgriesser/knex/issues/727","labels_url":"https://api.github.com/repos/tgriesser/knex/issues/727/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/knex/issues/727/comments","events_url":"https://api.github.com/repos/tgriesser/knex/issues/727/events","html_url":"https://github.com/tgriesser/knex/issues/727","id":60244131,"number":727,"title":"knex.raw() is not a function","user":{"login":"ozum","id":1497060,"avatar_url":"https://avatars.githubusercontent.com/u/1497060?v=3","gravatar_id":"","url":"https://api.github.com/users/ozum","html_url":"https://github.com/ozum","followers_url":"https://api.github.com/users/ozum/followers","following_url":"https://api.github.com/users/ozum/following{/other_user}","gists_url":"https://api.github.com/users/ozum/gists{/gist_id}","starred_url":"https://api.github.com/users/ozum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ozum/subscriptions","organizations_url":"https://api.github.com/users/ozum/orgs","repos_url":"https://api.github.com/users/ozum/repos","events_url":"https://api.github.com/users/ozum/events{/privacy}","received_events_url":"https://api.github.com/users/ozum/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-08T06:31:36Z","updated_at":"2015-03-08T16:06:24Z","closed_at":"2015-03-08T16:06:24Z","body":"I get 'raw is not a function' error when using knex raw as below:\r\n\r\n    var knex = require('knex')({ debug: false, client: 'pg' });\r\n    var query = knex.select('*').where('a', '=', 4);\r\n    query = query.where('b', '=', 4);\r\n    query = query.where(query.raw('c < 3'));  // <--- query.raw is not a function\r\n    console.log(query.toString());\r\n\r\nThe error I get is:\r\n\r\n    query = query.where(query.raw('c < 3'));\r\n                              ^\r\n    TypeError: undefined is not a function\r\n\r\nWhen I change my code as below, it seems fine:\r\n\r\n    var knex = require('knex')({ debug: false, client: 'pg' });\r\n    var query = knex.select('*').where('a', '=', 4);\r\n    query = query.where('b', '=', 4);\r\n    query = query.where(knex.raw('c < 3')); // <--- knex.raw is OK.\r\n    console.log(query.toString());\r\n\r\nThe problem is, I'm writing a utility library which I don't have knex variable available, I have just query.\r\n\r\nThank you,\r\n"},"comment":{"url":"https://api.github.com/repos/tgriesser/knex/issues/comments/77757780","html_url":"https://github.com/tgriesser/knex/issues/727#issuecomment-77757780","issue_url":"https://api.github.com/repos/tgriesser/knex/issues/727","id":77757780,"user":{"login":"bendrucker","id":808808,"avatar_url":"https://avatars.githubusercontent.com/u/808808?v=3","gravatar_id":"","url":"https://api.github.com/users/bendrucker","html_url":"https://github.com/bendrucker","followers_url":"https://api.github.com/users/bendrucker/followers","following_url":"https://api.github.com/users/bendrucker/following{/other_user}","gists_url":"https://api.github.com/users/bendrucker/gists{/gist_id}","starred_url":"https://api.github.com/users/bendrucker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bendrucker/subscriptions","organizations_url":"https://api.github.com/users/bendrucker/orgs","repos_url":"https://api.github.com/users/bendrucker/repos","events_url":"https://api.github.com/users/bendrucker/events{/privacy}","received_events_url":"https://api.github.com/users/bendrucker/received_events","type":"User","site_admin":false},"created_at":"2015-03-08T16:06:24Z","updated_at":"2015-03-08T16:06:24Z","body":"Not sure what to tell you here. Doesn't make sense to put a `raw` method on a query. It's only available on `knex`. "}}