From 52b929927329761c98e0bc8d79ea3b2dc5f1cf37 Mon Sep 17 00:00:00 2001
From: Sebastian Hoitz <hoitz@komola.de>
Date: Tue, 14 Oct 2014 17:08:37 +0200
Subject: [PATCH] Fix issue with chainable on calls in pg.

---
 lib/instrumentation/pg.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/instrumentation/pg.js b/lib/instrumentation/pg.js
index 3d8aa43f91..510029d2db 100644
--- a/lib/instrumentation/pg.js
+++ b/lib/instrumentation/pg.js
@@ -116,7 +116,7 @@ module.exports = function initialize(agent, pgsql) {
               shimmer.wrapMethod(res, 'query.on', 'on', function queryOnWrapper(on) {
                 return tracer.callbackProxy(function queryOnWrapped() {
                   if (arguments[1]) arguments[1] = tracer.callbackProxy(arguments[1])
-                  on.apply(this, arguments)
+                  return on.apply(this, arguments)
                 })
               })
 
@@ -197,7 +197,7 @@ module.exports = function initialize(agent, pgsql) {
       shimmer.wrapMethod(query, 'query.on', 'on', function queryOnWrapper(on) {
         return tracer.callbackProxy(function queryOnWrapped() {
           if (arguments[1]) arguments[1] = tracer.callbackProxy(arguments[1])
-          on.apply(this, arguments)
+          return on.apply(this, arguments)
         })
       })