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-postgresqlVerified import paths — ran on the pinned version, not inferred.
Connects to a PostgreSQL database, runs a SELECT query, and releases the connection using machinepack-postgresql's structured bindings.
Migrate to 'pg' (npm install pg) or 'sails-postgresql' for Sails apps.
Always call MPPostgresql.releaseConnection() after queries, or use a connection pool wrapper.
Call .exec() with callback or error/success exits. Alternatively, promisify with util.promisify.
Check the Waterline Driver Interface for supported options; use 'pg' directly for advanced features.
Ensure PostgreSQL is running: sudo service postgresql start (Linux) or brew services start postgresql (macOS).
Set correct password in connection or configure pg_hba.conf to allow trust for local connections.
Use const MPPostgresql = require('machinepack-postgresql'); then call MPPostgresql.getConnection(...).