Registry / database / node-red-contrib-re-postgres

node-red-contrib-re-postgres

JSON →
library0.3.7jsnpmunverified

A Node-RED node for querying PostgreSQL databases. Version 0.3.7 is current and maintained, with moderate release cadence. It replaces the original node by Kris Daniels to ensure compatibility with latest Node-RED versions. Key differentiator: supports template-based queries using msg.queryParameters with $propertyName substitution, and offers row-by-row output via 'One message per row' option. Allows connection string configuration.

npm install node-red-contrib-re-postgres
INSTALL
IMPORT
SIG · NODE-RED-CONTRIB-R
N
node-red-contrib-re-postgres
databasejavascriptv0.3.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

node-red-contrib-re-postgres
Install as a Node-RED node via npm. No import in code; configure in Node-RED UI.
Attempting to import as JavaScript module directrly (e.g., require('node-red-contrib-re-postgres'))
This is a Node-RED node, not a library to import via require/import. Use npm install and configure in Node-RED flows.

Creates a Node-RED flow with inject node providing query parameters, PostgreSQL node executing the query, and debug showing result.

// Node-RED flow JSON example [ { "id": "n1", "type": "inject", "z": "flow1", "name": "", "props": [{"p": "payload"}, {"p": "queryParameters", "v": {"type": "json", "json": "{\"id\": 1, \"name\": \"test\"}"}}], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "SELECT * FROM users WHERE id = $id AND name = $name", "payloadType": "str" }, { "id": "n2", "type": "postgres", "z": "flow1", "name": "", "config": "postgres config", "x": 400, "y": 200, "wires": [["n3"]] }, { "id": "n3", "type": "debug", "z": "flow1", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg" }, { "id": "postgres config", "type": "postgres-config", "name": "My DB", "connectionString": "postgresql://user:password@localhost:5432/mydb", "z": "flow1" } ]
Debug
Known issues
gotchamsg.queryParameters must be an object with string keys; nested objects may not work
fix
Ensure msg.queryParameters is a flat object. Use dot notation? Not supported; use $propertyName only.
affects: >=0.0.0
gotchaQuery template uses $propertyName, not $1, $2 placeholders – users may expect positional parameters
fix
Use $propertyName syntax; do not use $1, $2.
affects: >=0.0.0
deprecatedOriginal node (node-red-node-postgres) may still be installed side by side, causing confusion
fix
Uninstall the original node if using this one.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'pg'
Missing PostgreSQL client dependency
fix
Run 'npm install pg' in your Node-RED directory.
Error: connect ECONNREFUSED 127.0.0.1:5432
PostgreSQL server not running or connection string wrong
fix
Ensure PostgreSQL is running and connection string is correct.
msg.error: relation "table" does not exist
Table name misspelled or schema not public
fix
Check table name and schema; use schema.table format.
Upgrade
Version history
0.3.7latest on npm
Audit
Dependencies
node-redrequiredRuntime dependency: Node-RED must be installed
pgrequiredRequired for PostgreSQL client functionality
Agent activity
2 hits · last 30 days
node
2
Resources
node-red-contrib-re-postgres — npm install node-red-contrib-re-postgres · libregistry