From f10a7b5323cf9d566ddfd9b3656f3a5790deb9b9 Mon Sep 17 00:00:00 2001 From: furiozo Date: Sun, 29 May 2022 13:38:24 +0300 Subject: [PATCH] feat: add connection parameter nativeConnectionString for when you want to pass connection string AS IS to pg-native which allows the use of features present in libpq but still not impremented in the js drivers --- packages/pg/lib/native/client.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/pg/lib/native/client.js b/packages/pg/lib/native/client.js index d1faeb3d8..372b8a0a7 100644 --- a/packages/pg/lib/native/client.js +++ b/packages/pg/lib/native/client.js @@ -30,6 +30,7 @@ var Client = (module.exports = function (config) { // keep these on the object for legacy reasons // for the time being. TODO: deprecate all this jazz var cp = (this.connectionParameters = new ConnectionParameters(config)) + if (config.nativeConnectionString) cp.nativeConnectionString = config.nativeConnectionString this.user = cp.user // "hiding" the password so it doesn't show up in stack traces @@ -84,6 +85,7 @@ Client.prototype._connect = function (cb) { this.connectionParameters.getLibpqConnectionString(function (err, conString) { if (err) return cb(err) + if (self.connectionParameters.nativeConnectionString) conString = self.connectionParameters.nativeConnectionString self.native.connect(conString, function (err) { if (err) { self.native.end()