Hi, I just tried to use pg-cursor with a simple select:
ReferenceError: setImmediate is not defined
at Cursor._sendRows (/foo/tools/lib/node_modules/pg-cursor/index.js:51:3)
at Cursor.handlePortalSuspended (/foo/tools/lib/node_modules/pg-cursor/index.js:64:8)
at Client.connect.con.once.con.on.self.constructor.port (/foo/tools/lib/node_modules/pg/lib/client.js:112:24)
at EventEmitter.emit (events.js:96:17)
at Connection.attachListeners (/foo/tools/lib/node_modules/pg/lib/connection.js:97:12)
at Socket.EventEmitter.emit (events.js:96:17)
at TCP.onread (net.js:397:14)
What version of node are you using? Looks like setImmediate was added in v0.10: https://github.com/joyent/node/wiki/Api-changes-between-v0.8-and-v0.10
Ah, yes we're using v0.8 and I guess that stopped being supported. Will need to bite the bullet and upgrade soon. We just haven't hit a compelling reason to do so yet.
You can also do this somewhere in code & it should work....
global.setImmediate = global.setImmediate || process.nextTick.bind(process)
I don't rely on any of the intricacies of setImmediate versus process.nextTick so you're safe to monkey-patch.