diff --git a/lib/index.js b/lib/index.js index bb2041b..6bd6838 100644 --- a/lib/index.js +++ b/lib/index.js @@ -52,12 +52,15 @@ PG.prototype.cancel = function(config, client, query) { cancellingClient.cancel(client, query); }; -module.exports = new PG(Client); - -//lazy require native module...the native module may not have installed -module.exports.__defineGetter__("native", function() { - delete module.exports.native; - module.exports.native = new PG(require(__dirname + '/native')); - return module.exports.native; -}); +if (process.env.hasOwnProperty('NODE_PG_FORCE_NATIVE')) { + module.exports = new PG(require(__dirname + '/native')); +} else { + module.exports = new PG(Client); + //lazy require native module...the native module may not have installed + module.exports.__defineGetter__("native", function() { + delete module.exports.native; + module.exports.native = new PG(require(__dirname + '/native')); + return module.exports.native; + }); +}