| 1 | # node-postgres
|
|---|
| 2 |
|
|---|
| 3 | [](http://travis-ci.org/brianc/node-postgres)
|
|---|
| 4 | <span class="badge-npmversion"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/v/pg.svg" alt="NPM version" /></a></span>
|
|---|
| 5 | <span class="badge-npmdownloads"><a href="https://npmjs.org/package/pg" title="View this project on NPM"><img src="https://img.shields.io/npm/dm/pg.svg" alt="NPM downloads" /></a></span>
|
|---|
| 6 |
|
|---|
| 7 | Non-blocking PostgreSQL client for Node.js. Pure JavaScript and optional native libpq bindings.
|
|---|
| 8 |
|
|---|
| 9 | ## Install
|
|---|
| 10 |
|
|---|
| 11 | ```sh
|
|---|
| 12 | $ npm install pg
|
|---|
| 13 | ```
|
|---|
| 14 |
|
|---|
| 15 | ---
|
|---|
| 16 |
|
|---|
| 17 | ## :star: [Documentation](https://node-postgres.com) :star:
|
|---|
| 18 |
|
|---|
| 19 | ### Features
|
|---|
| 20 |
|
|---|
| 21 | - [Fastest PostgreSQL client for Node.js](https://github.com/nigrosimone/postgres-benchmarks)
|
|---|
| 22 | - Pure JavaScript client and native libpq bindings share _the same API_
|
|---|
| 23 | - Connection pooling
|
|---|
| 24 | - Extensible JS ↔ PostgreSQL data-type coercion
|
|---|
| 25 | - Supported PostgreSQL features
|
|---|
| 26 | - Parameterized queries
|
|---|
| 27 | - Named statements with query plan caching
|
|---|
| 28 | - Async notifications with `LISTEN/NOTIFY`
|
|---|
| 29 | - Bulk import & export with `COPY TO/COPY FROM`
|
|---|
| 30 |
|
|---|
| 31 | ### Extras
|
|---|
| 32 |
|
|---|
| 33 | node-postgres is by design pretty light on abstractions. These are some handy modules we've been using over the years to complete the picture.
|
|---|
| 34 | The entire list can be found on our [wiki](https://github.com/brianc/node-postgres/wiki/Extras).
|
|---|
| 35 |
|
|---|
| 36 | ## Support
|
|---|
| 37 |
|
|---|
| 38 | node-postgres is free software. If you encounter a bug with the library please open an issue on the [GitHub repo](https://github.com/brianc/node-postgres). If you have questions unanswered by the documentation please open an issue pointing out how the documentation was unclear & I will do my best to make it better!
|
|---|
| 39 |
|
|---|
| 40 | When you open an issue please provide:
|
|---|
| 41 |
|
|---|
| 42 | - version of Node
|
|---|
| 43 | - version of Postgres
|
|---|
| 44 | - smallest possible snippet of code to reproduce the problem
|
|---|
| 45 |
|
|---|
| 46 | You can also follow me [@brianc](https://bsky.app/profile/brianc.bsky.social) on bluesky if that's your thing for updates on node-postgres with nearly zero non node-postgres content. My old twitter/x account is no longer used.
|
|---|
| 47 |
|
|---|
| 48 | ## Sponsorship :two_hearts:
|
|---|
| 49 |
|
|---|
| 50 | node-postgres's continued development has been made possible in part by generous financial support from [the community](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
|
|---|
| 51 |
|
|---|
| 52 | If you or your company are benefiting from node-postgres and would like to help keep the project financially sustainable [please consider supporting](https://github.com/sponsors/brianc) its development.
|
|---|
| 53 |
|
|---|
| 54 | ### Featured sponsor
|
|---|
| 55 |
|
|---|
| 56 | Special thanks to [medplum](https://medplum.com) for their generous and thoughtful support of node-postgres!
|
|---|
| 57 |
|
|---|
| 58 | 
|
|---|
| 59 |
|
|---|
| 60 | ## Contributing
|
|---|
| 61 |
|
|---|
| 62 | **:heart: contributions!**
|
|---|
| 63 |
|
|---|
| 64 | I will **happily** accept your pull request if it:
|
|---|
| 65 |
|
|---|
| 66 | - **has tests**
|
|---|
| 67 | - looks reasonable
|
|---|
| 68 | - does not break backwards compatibility
|
|---|
| 69 |
|
|---|
| 70 | If your change involves breaking backwards compatibility please please point that out in the pull request & we can discuss & plan when and how to release it and what type of documentation or communicate it will require.
|
|---|
| 71 |
|
|---|
| 72 | ## Troubleshooting and FAQ
|
|---|
| 73 |
|
|---|
| 74 | The causes and solutions to common errors can be found among the [Frequently Asked Questions (FAQ)](https://github.com/brianc/node-postgres/wiki/FAQ)
|
|---|
| 75 |
|
|---|
| 76 | ## License
|
|---|
| 77 |
|
|---|
| 78 | Copyright (c) 2010-2020 Brian Carlson (brian.m.carlson@gmail.com)
|
|---|
| 79 |
|
|---|
| 80 | Permission is hereby granted, free of charge, to any person obtaining a copy
|
|---|
| 81 | of this software and associated documentation files (the "Software"), to deal
|
|---|
| 82 | in the Software without restriction, including without limitation the rights
|
|---|
| 83 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|---|
| 84 | copies of the Software, and to permit persons to whom the Software is
|
|---|
| 85 | furnished to do so, subject to the following conditions:
|
|---|
| 86 |
|
|---|
| 87 | The above copyright notice and this permission notice shall be included in
|
|---|
| 88 | all copies or substantial portions of the Software.
|
|---|
| 89 |
|
|---|
| 90 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|---|
| 91 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|---|
| 92 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|---|
| 93 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|---|
| 94 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|---|
| 95 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|---|
| 96 | THE SOFTWARE.
|
|---|