Registry / database / machinepack-postgresql

machinepack-postgresql

JSON →
library4.0.2jsnpmunverified

Structured Node.js bindings for connecting to and running queries against a PostgreSQL database. Version 4.0.2 is the latest stable release. It is part of the Sails.js ecosystem and implements the Waterline Driver Interface. Release cadence is irregular; primarily maintained for legacy Sails applications. Key differentiators: uses machine definitions for structured operations, integrates with Sails' Waterline ORM, wraps the `pg` driver. Unmaintained since 2017; prefer `pg` directly or newer Waterline adapters.

npm install machinepack-postgresql
INSTALL
IMPORT
SIG · MACHINEPACK-POSTGR
M
machinepack-postgresql
databasejavascriptv4.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import MPPostgresql from 'machinepack-postgresql'
const MPPostgresql = require('machinepack-postgresql')
ESM import works but the package is CJS-only; use require for compatibility.
getConnection
var MPPostgresql = require('machinepack-postgresql'); MPPostgresql.getConnection({...}).exec(...)
import { getConnection } from 'machinepack-postgresql'
Named exports are not available; use the default export object.
sendQuery
var MPPostgresql = require('machinepack-postgresql'); MPPostgresql.sendQuery({...}).exec(...)
const sendQuery = require('machinepack-postgresql').sendQuery
Methods are on the default export, not separately exported.

Connects to a PostgreSQL database, runs a SELECT query, and releases the connection using machinepack-postgresql's structured bindings.

var MPPostgresql = require('machinepack-postgresql'); // Get a connection MPPostgresql.getConnection({ host: 'localhost', port: 5432, user: 'postgres', password: process.env.PGPASSWORD || '', database: 'mydb' }).exec({ error: function(err) { console.log('Error:', err); }, success: function(connection) { // Send a query MPPostgresql.sendQuery({ connection: connection, query: 'SELECT * FROM users LIMIT 1' }).exec({ error: function(err) { console.log('Query error:', err); }, success: function(result) { console.log('Result:', result); MPPostgresql.releaseConnection({ connection: connection }).exec(); } }); } });
Debug
Known issues
deprecatedThis package is no longer actively maintained. Use the 'pg' package directly or a modern Waterline adapter like 'sails-postgresql'.
fix
Migrate to 'pg' (npm install pg) or 'sails-postgresql' for Sails apps.
affects: >=4.0.0
gotchaThe connection object must be released manually. Forgetting to release can exhaust connection pool.
fix
Always call MPPostgresql.releaseConnection() after queries, or use a connection pool wrapper.
affects: *
gotchaAll method calls use the machinepack pattern with .exec(), not Promises. This is unlike many modern Node.js libraries.
fix
Call .exec() with callback or error/success exits. Alternatively, promisify with util.promisify.
affects: *
gotchaThe package wraps 'pg' but exposes a different API. Direct 'pg' configuration options may not be passed through.
fix
Check the Waterline Driver Interface for supported options; use 'pg' directly for advanced features.
affects: *
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:5432
PostgreSQL server is not running or not accessible at the specified host/port.
fix
Ensure PostgreSQL is running: sudo service postgresql start (Linux) or brew services start postgresql (macOS).
error: password authentication failed for user "postgres"
Incorrect password or missing pg_hba.conf configuration.
fix
Set correct password in connection or configure pg_hba.conf to allow trust for local connections.
TypeError: MPPostgresql.getConnection is not a function
Importing the module incorrectly, e.g., using named import or destructuring.
fix
Use const MPPostgresql = require('machinepack-postgresql'); then call MPPostgresql.getConnection(...).
Upgrade
Version history
4.0.2latest on npm
Audit
Dependencies
pgrequiredCore PostgreSQL driver
machinerequiredDefines machinepack structure
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
machinepack-postgresql — npm install machinepack-postgresql · libregistry