You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you call `client.query` with query text and optional parameters but **don't** pass a callback, then you will receive a `Promise` for a query result.
When the client is in the process of connecting, dispatching a query, or disconnecting it will catch and foward errors from the PostgreSQL server to the respective `client.connect``client.query` or `client.end` callback/promise; however, the client maintains a long-lived connection to the PostgreSQL back-end and due to network partitions, back-end crashes, fail-overs, etc the client can (and over a long enough time period _will_) eventually be disconnected while it is idle. To handle this you may want to attach an error listener to a client to catch errors. Here's a contrived example:
Copy file name to clipboardExpand all lines: docs/pages/apis/pool.mdx
+6-2
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,9 @@ const pool = new Pool({
63
63
64
64
Often we only need to run a single query on the database, so as convenience the pool has a method to run a query on the first available idle client and return its result.
Copy file name to clipboardExpand all lines: docs/pages/index.mdx
+1-14
Original file line number
Diff line number
Diff line change
@@ -13,20 +13,7 @@ $ npm install pg
13
13
14
14
## Supporters
15
15
16
-
node-postgres continued development and support is made possible by the many [supporters](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md) with a special thanks to our featured supporters:
node-postgres continued development and support is made possible by the many [supporters](https://github.com/brianc/node-postgres/blob/master/SPONSORS.md).
30
17
31
18
If you or your company would like to sponsor node-postgres stop by [github sponsors](https://github.com/sponsors/brianc) and sign up or feel free to [email me](mailto:brian@pecanware.com) if you want to add your logo to the documentation or discuss higher tiers of sponsorship!
0 commit comments