From 19f7183e17b34c1b68d5454d9ef63d03bf357fcc Mon Sep 17 00:00:00 2001 From: Daniel Diekmeier Date: Thu, 5 Mar 2026 13:25:20 +0100 Subject: [PATCH] Don't encourage people to use on('connect') for setup anymore --- docs/pages/apis/pool.mdx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/pages/apis/pool.mdx b/docs/pages/apis/pool.mdx index d9323979e..123bc8ba4 100644 --- a/docs/pages/apis/pool.mdx +++ b/docs/pages/apis/pool.mdx @@ -232,14 +232,11 @@ The number of queued requests waiting on a client when all clients are checked o `pool.on('connect', (client: Client) => void) => void` -Whenever the pool establishes a new client connection to the PostgreSQL backend it will emit the `connect` event with the newly connected client. This presents an opportunity for you to run setup commands on a client. +Whenever the pool establishes a new client connection to the PostgreSQL backend it will emit the `connect` event with the newly connected client. -```js -const pool = new Pool() -pool.on('connect', (client) => { - client.query('SET DATESTYLE = iso, mdy') -}) -``` + + The event listener does not wait for promises or async functions. If you want to run setup commands on each new client, use the `onConnect` option. (See documentation above.) + ### acquire