From 089214e85c23c90cf142d47fb30bd03f42874984 Mon Sep 17 00:00:00 2001 From: Louis Orleans Date: Tue, 21 Jan 2025 17:16:15 -0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20fix=20CONNECT=5FTIMEOU?= =?UTF-8?q?T=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `CONNECT_TIMEOUT` error's name is `CONNECT_TIMEOUT`, not `CONNECTION_CONNECT_TIMEOUT`. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1dcdd668..b79c207f 100644 --- a/README.md +++ b/README.md @@ -1303,8 +1303,8 @@ This error is thrown if the user has called [`sql.end()`](#teardown--cleanup) an This error is thrown for any queries that were pending when the timeout to [`sql.end({ timeout: X })`](#teardown--cleanup) was reached. -##### CONNECTION_CONNECT_TIMEOUT -> write CONNECTION_CONNECT_TIMEOUT host:port +##### CONNECT_TIMEOUT +> write CONNECT_TIMEOUT host:port This error is thrown if the startup phase of the connection (tcp, protocol negotiation, and auth) took more than the default 30 seconds or what was specified using `connect_timeout` or `PGCONNECT_TIMEOUT`. From ad0ed4476e09f41f147859cb5a42971d2b99e9c7 Mon Sep 17 00:00:00 2001 From: adrtivv Date: Fri, 11 Apr 2025 00:37:07 +0530 Subject: [PATCH 2/3] fixed typings for generic error code variants --- types/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 8989ff47..eb604918 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -456,7 +456,8 @@ declare namespace postgres { | 'NOT_TAGGED_CALL' | 'UNDEFINED_VALUE' | 'MAX_PARAMETERS_EXCEEDED' - | 'SASL_SIGNATURE_MISMATCH'; + | 'SASL_SIGNATURE_MISMATCH' + | 'UNSAFE_TRANSACTION'; message: string; } From b0d8c8f363e006a74472d76f859da60c52a80368 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Sat, 3 May 2025 21:23:22 -0500 Subject: [PATCH 3/3] docs: Add prepare: true to sql.unsafe docs. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b79c207f..c135cd17 100644 --- a/README.md +++ b/README.md @@ -568,6 +568,8 @@ If you know what you're doing, you can use `unsafe` to pass any string you'd lik sql.unsafe('select ' + danger + ' from users where id = ' + dragons) ``` +By default, `sql.unsafe` assumes the `query` string is sufficiently dynamic that prepared statements do not make sense, and so defaults them to off. If you'd like to re-enable prepared statements, you can pass `{ prepare: true }`. + You can also nest `sql.unsafe` within a safe `sql` expression. This is useful if only part of your fraction has unsafe elements. ```js