pg
8.23.1 · 30 Sep 2026MIT106.3M / weekRepositorynpmAtom feed
6.4.2 is the newest release of 6.x.
In short
1 breaking2 new
- Breaking
Remove
pg.pools. There is still a reference kept to the pools created & tracked bypg.connectbut it has been renamed, is considered private, and should not be used. Accessing this API directly was uncommon and was supposed to be private but was incorrectly documented on the wiki. Therefore, it is a breaking change of an (unintentionally) public interface to remove it by renaming it & making it private. Eventuallypg.connectitself will be deprecated in favor of instantiating pools directly vianew pg.Pool()so this property should become completely moot at some point. In the mean time...check out the new features...
Security
1 advisory affects 6.0.0; 6.4.2 fixes them
- CriticalRemote Code Execution in pgGHSA-wc9v-mj63-m9g5 · 24 Jul 2018Fixed in 6.4.2
Release note
Breaking Changes
- Breaking
Remove
pg.pools. There is still a reference kept to the pools created & tracked bypg.connectbut it has been renamed, is considered private, and should not be used. Accessing this API directly was uncommon and was supposed to be private but was incorrectly documented on the wiki. Therefore, it is a breaking change of an (unintentionally) public interface to remove it by renaming it & making it private. Eventuallypg.connectitself will be deprecated in favor of instantiating pools directly vianew pg.Pool()so this property should become completely moot at some point. In the mean time...check out the new features...
New features
Replace internal pooling code with pg-pool. This is the first step in eventually deprecating and removing the singleton
pg.connect. The pg-pool constructor is exported from node-postgres atrequire('pg').Pool. It provides a backwards compatible interface withpg.connectas well as a promise based interface & additional niceties.
You can now create an instance of a pool and don't have to rely on the pg singleton for anything:
var pg = require('pg')
var pool = new pg.Pool()
// your friendly neighborhood pool interface, without the singleton
pool.connect(function(err, client, done) {
// ...
})Promise support & other goodness lives now in pg-pool.
Please read the readme at pg-pool for the full api.
Included support for tcp keep alive. Enable it as follows:
var client = new Client({ keepAlive: true })This should help with backends incorrectly considering idle clients to be dead and prematurely disconnecting them.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.