{"id":44428050,"url":"https://github.com/alexandrainst/node-red-contrib-postgresql","last_synced_at":"2026-02-12T11:30:59.043Z","repository":{"id":37212589,"uuid":"390253448","full_name":"alexandrainst/node-red-contrib-postgresql","owner":"alexandrainst","description":"Node-RED node for PostgreSQL, supporting parameters, split, back-pressure","archived":false,"fork":false,"pushed_at":"2026-02-01T11:08:11.000Z","size":1080,"stargazers_count":37,"open_issues_count":13,"forks_count":11,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-01T20:55:33.346Z","etag":null,"topics":["node-red","node-red-contrib","postgresql"],"latest_commit_sha":null,"homepage":"https://flows.nodered.org/node/node-red-contrib-postgresql","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexandrainst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-28T07:18:40.000Z","updated_at":"2026-02-01T11:08:13.000Z","dependencies_parsed_at":"2024-02-01T13:47:03.253Z","dependency_job_id":"763107ca-b2a9-418f-a82a-2b6c038feb41","html_url":"https://github.com/alexandrainst/node-red-contrib-postgresql","commit_stats":{"total_commits":127,"total_committers":12,"mean_commits":"10.583333333333334","dds":0.7244094488188977,"last_synced_commit":"647c82ad7271ea53187e7eb83ed71454cd667ef4"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/alexandrainst/node-red-contrib-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrainst%2Fnode-red-contrib-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrainst%2Fnode-red-contrib-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrainst%2Fnode-red-contrib-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrainst%2Fnode-red-contrib-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexandrainst","download_url":"https://codeload.github.com/alexandrainst/node-red-contrib-postgresql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexandrainst%2Fnode-red-contrib-postgresql/sbom","scorecard":{"id":180581,"data":{"date":"2025-08-11","repo":{"name":"github.com/alexandrainst/node-red-contrib-postgresql","commit":"8efbb884c75bcb31a16647d86c9e125d7fd725ad"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.8,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"11 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":9,"reason":"SAST tool is not run on all commits -- score normalized to 9","details":["Warn: 22 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T18:47:40.053Z","repository_id":37212589,"created_at":"2025-08-16T18:47:40.053Z","updated_at":"2025-08-16T18:47:40.053Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29364207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node-red","node-red-contrib","postgresql"],"created_at":"2026-02-12T11:30:58.115Z","updated_at":"2026-02-12T11:30:59.038Z","avatar_url":"https://github.com/alexandrainst.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-red-contrib-postgresql\n\n[node-red-contrib-postgresql](https://github.com/alexandrainst/node-red-contrib-postgresql)\nis a [**Node-RED**](https://nodered.org/) node to query a [**PostgreSQL**](https://www.postgresql.org/) 🐘 database.\n\nIt supports *splitting* the resultset and *backpressure* (flow control), to allow working with large datasets.\n\nIt supports *parameterized queries* and *multiple queries*.\n\n## Outputs\n\nThe response (rows) is provided in `msg.payload` as an array.\n\nAn exception is if the *Split results* option is enabled and the *Number of rows per message* is set to **1**,\nthen `msg.payload` is not an array but the single-row response.\n\nAdditional information is provided as `msg.pgsql.rowCount` and `msg.pgsql.command`.\nSee the [underlying documentation](https://node-postgres.com/apis/result) for details.\n\nIn the case of multiple queries, then `msg.pgsql` is an array.\n\n## Inputs\n\n### SQL query template\n\nThis node uses the [Mustache template system](https://github.com/janl/mustache.js) to generate queries based on the message:\n\n```sql\n-- INTEGER id column\nSELECT * FROM table WHERE id = {{{ msg.id }}};\n\n-- TEXT id column\nSELECT * FROM table WHERE id = '{{{ msg.id }}}';\n```\n\n### Dynamic SQL queries\n\nAs an alternative to using the query template above, this node also accepts an SQL query via the `msg.query` parameter.\n\n### Parameterized query (numeric)\n\nParameters for parameterized queries can be passed as a parameter array `msg.params`:\n\n```js\n// In a function, provide parameters for the parameterized query\nmsg.params = [ msg.id ];\n```\n\n```sql\n-- In this node, use a parameterized query\nSELECT * FROM table WHERE id = $1;\n```\n\n### Named parameterized query\n\nAs an alternative to numeric parameters,\nnamed parameters for parameterized queries can be passed as a parameter object `msg.queryParameters`:\n\n```js\n// In a function, provide parameters for the named parameterized query\nmsg.queryParameters.id = msg.id;\n```\n\n```sql\n-- In this node, use a named parameterized query\nSELECT * FROM table WHERE id = $id;\n```\n\n*Note*: named parameters are not natively supported by PostgreSQL, and this library just emulates them,\nso this is less robust than numeric parameters.\n\n### Dynamic PostgreSQL connection parameters\n\nIf the information about which database server to connect and how needs to be dynamic,\nit is possible to pass a [custom client configuration](https://node-postgres.com/apis/client) in the message:\n\n```js\nmsg.pgConfig = {\n  user?: string, // default process.env.PGUSER || process.env.USER\n  password?: string, //or function, default process.env.PGPASSWORD\n  host?: string, // default process.env.PGHOST\n  database?: string, // default process.env.PGDATABASE || process.env.USER\n  port?: number, // default process.env.PGPORT\n  connectionString?: string, // e.g. postgres://user:password@host:5432/database\n  ssl?: any, // passed directly to node.TLSSocket, supports all tls.connect options\n  types?: any, // custom type parsers\n  statement_timeout?: number, // number of milliseconds before a statement in query will time out, default is no timeout\n  query_timeout?: number, // number of milliseconds before a query call will timeout, default is no timeout\n  application_name?: string, // The name of the application that created this Client instance\n  connectionTimeoutMillis?: number, // number of milliseconds to wait for connection, default is no timeout\n  idle_in_transaction_session_timeout?: number, // number of milliseconds before terminating any session with an open idle transaction, default is no timeout\n};\n```\n\nHowever, this does not use a [connection pool](https://node-postgres.com/features/pooling), and is therefore less efficient.\nIt is therefore recommended in most cases not to use `msg.pgConfig` at all and instead stick to the built-in configuration node.\n\n## Installation\n\n### Using the Node-RED Editor\n\nYou can install [**node-red-contrib-postgresql**](https://flows.nodered.org/node/node-red-contrib-postgresql) directly using the editor:\nSelect *Manage Palette* from the menu (top right), and then select the *Install* tab in the palette.\n\n### Using npm\n\nYou can alternatively install the [npm-packaged node](https://www.npmjs.com/package/node-red-contrib-postgresql):\n\n* Locally within your user data directory (by default, `$HOME/.node-red`):\n\n```sh\ncd $HOME/.node-red\nnpm i node-red-contrib-postgresql\n```\n\n* or globally alongside Node-RED:\n\n```sh\nnpm i -g node-red-contrib-postgresql\n```\n\nYou will then need to restart Node-RED.\n\n## Backpressure\n\nThis node supports *backpressure* / *flow control*:\nwhen the *Split results* option is enabled, it waits for a *tick* before releasing the next batch of lines,\nto make sure the rest of your Node-RED flow is ready to process more data\n(instead of risking an out-of-memory condition), and also conveys this information upstream.\n\nSo when the *Split results* option is enabled, this node will only output one message at first,\nand then awaits a message containing a truthy `msg.tick` before releasing the next message.\n\nTo make this behaviour potentially automatic (avoiding manual wires), this node declares its ability by exposing a truthy `node.tickConsumer`\nfor downstream nodes to detect this feature, and a truthy `node.tickProvider` for upstream nodes.\nLikewise, this node detects upstream nodes using the same back-pressure convention, and automatically sends ticks.\n\n### Example of flow\n\nExample adding a new column in a table, then streaming (split) many lines from that table, batch-updating several lines at a time,\nthen getting a sample consisting of a few lines:\n\nExample: [flow.json](examples/flow.json)\n\n![Node-RED flow](examples/flow.png)\n\nThe *debug* nodes illustrate some relevant information to look at.\n\n## Sequences for split results\n\nWhen the *Split results* option is enabled (streaming), the messages contain some information following the\nconventions for [*messages sequences*](https://nodered.org/docs/user-guide/messages#message-sequences).\n\n```js\n{\n  payload: '...',\n  parts: {\n    id: 0.1234, // sequence ID, randomly generated (changes for every sequence)\n    index: 5, // incremented for each message of the same sequence\n    count: 6, // total number of messages; only available in the last message of a sequence\n    parts: {}, // optional upstream parts information\n  },\n  complete: true, // True only for the last message of a sequence\n}\n```\n\n## Credits\n\nMajor rewrite in July 2021 by [Alexandre Alapetite](https://alexandra.dk/alexandre.alapetite) ([Alexandra Institute](https://alexandra.dk)),\nof parents forks:\n[andreabat](https://github.com/andreabat/node-red-contrib-postgrestor) /\n[ymedlop](https://github.com/doing-things-with-node-red/node-red-contrib-postgrestor) /\n[HySoaKa](https://github.com/HySoaKa/node-red-contrib-postgrestor),\nwith inspiration from [node-red-contrib-re-postgres](https://flows.nodered.org/node/node-red-contrib-re-postgres)\n([code](https://github.com/elmagopy/node-red-contrib-re2-postgres)).\n\nThis node builds uppon the [node-postgres](https://github.com/brianc/node-postgres) (`pg`) library.\n\nContributions and collaboration welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandrainst%2Fnode-red-contrib-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexandrainst%2Fnode-red-contrib-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexandrainst%2Fnode-red-contrib-postgresql/lists"}