{"action":"opened","issue":{"url":"https://api.github.com/repos/tgriesser/knex/issues/1102","labels_url":"https://api.github.com/repos/tgriesser/knex/issues/1102/labels{/name}","comments_url":"https://api.github.com/repos/tgriesser/knex/issues/1102/comments","events_url":"https://api.github.com/repos/tgriesser/knex/issues/1102/events","html_url":"https://github.com/tgriesser/knex/issues/1102","id":122800999,"number":1102,"title":"Reading then updating throws an Error","user":{"login":"flawyte","id":1585006,"avatar_url":"https://avatars.githubusercontent.com/u/1585006?v=3","gravatar_id":"","url":"https://api.github.com/users/flawyte","html_url":"https://github.com/flawyte","followers_url":"https://api.github.com/users/flawyte/followers","following_url":"https://api.github.com/users/flawyte/following{/other_user}","gists_url":"https://api.github.com/users/flawyte/gists{/gist_id}","starred_url":"https://api.github.com/users/flawyte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flawyte/subscriptions","organizations_url":"https://api.github.com/users/flawyte/orgs","repos_url":"https://api.github.com/users/flawyte/repos","events_url":"https://api.github.com/users/flawyte/events{/privacy}","received_events_url":"https://api.github.com/users/flawyte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-17T19:03:31Z","updated_at":"2015-12-17T19:03:31Z","closed_at":null,"body":"I'm trying to chain read and update operations. First I read (fetch) data from the database based on its **id**, then I change it and want to update the data in the database as well but I get a `Unhandled rejection Error: There is no pool defined on the current client` error.\r\n\r\n**index.js**\r\n\r\n    var id = args.id;\r\n    var proj = new Project(id);\r\n    \r\n    proj.read(knex).then(function(rows) {\r\n      proj.set(args);\r\n      proj.update(knex).then(console.log); // <== ERROR THROWN HERE\r\n    });\r\n\r\n**Project.js** (only related functions)\r\n\r\n    read(knex) {\r\n      var self = this;\r\n    \r\n      return knex('projects').where('id', this.id).then(function(rows) {\r\n        if (rows.length == 0)\r\n          throw '[panda] Read project: no project with id = ' + self.id;\r\n        self.set(rows[0]);\r\n    \r\n        return self;\r\n      });\r\n    }\r\n    \r\n    update(knex) {\r\n      console.log(knex('projects').where('id', this.id).update(this).toString());\r\n    \r\n      return knex('projects').where('id', this.id).update(this);\r\n    }\r\n\r\n**Command**\r\n\r\n    $ node index.js projects update --id=5 --name=Test-update\r\n    update \"projects\" set \"completion\" = 0, \"currentIteration\" = NULL, \"id\" = 5, \"name\" = 'Test-update' where \"id\" = 5\r\n    Unhandled rejection Error: There is no pool defined on the current client\r\n        at /home/flawyte/development/projects/js/panda/node_modules/knex/lib/client.js:202:25\r\n        at tryCatcher (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/util.js:26:23)\r\n        at Promise._resolveFromResolver (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/promise.js:480:31)\r\n        at new Promise (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/promise.js:70:37)\r\n        at Client.acquireConnection (/home/flawyte/development/projects/js/panda/node_modules/knex/lib/client.js:200:12)\r\n        at /home/flawyte/development/projects/js/panda/node_modules/knex/lib/runner.js:136:49\r\n        at tryCatcher (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/util.js:26:23)\r\n        at Function.Promise.attempt.Promise.try (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/method.js:31:24)\r\n        at Runner.ensureConnection (/home/flawyte/development/projects/js/panda/node_modules/knex/lib/runner.js:135:26)\r\n        at Runner.run (/home/flawyte/development/projects/js/panda/node_modules/knex/lib/runner.js:30:31)\r\n        at QueryBuilder.Target.then (/home/flawyte/development/projects/js/panda/node_modules/knex/lib/interface.js:27:43)\r\n        at /home/flawyte/development/projects/js/panda/index.js:80:31\r\n        at tryCatcher (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/util.js:26:23)\r\n        at Promise._settlePromiseFromHandler (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/promise.js:507:31)\r\n        at Promise._settlePromiseAt (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/promise.js:581:18)\r\n        at Promise._settlePromises (/home/flawyte/development/projects/js/panda/node_modules/bluebird/js/main/promise.js:697:14)\r\n\r\nIf I remove the `then(console.log)` in **index.js** no error is thrown but data in database remains unchanged after script ending. Why ?"}}