From f986bb8a9cdabbad01f806cd31326a8232ac3243 Mon Sep 17 00:00:00 2001 From: Steven Guerrero Date: Tue, 7 Jun 2022 17:42:11 -0500 Subject: [PATCH] fix: Don't send options connection parameter unless supplied (#404) --- connection/connection.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/connection/connection.ts b/connection/connection.ts index b6212b2a..1764a25b 100644 --- a/connection/connection.ts +++ b/connection/connection.ts @@ -219,12 +219,14 @@ export class Connection { writer.addCString("application_name").addCString( this.#connection_params.applicationName, ); - // The database expects options in the --key=value - writer.addCString("options").addCString( - Object.entries(this.#connection_params.options).map(([key, value]) => - `--${key}=${value}` - ).join(" "), - ); + + const connection_options = Object.entries(this.#connection_params.options); + if (connection_options.length > 0) { + // The database expects options in the --key=value + writer.addCString("options").addCString( + connection_options.map(([key, value]) => `--${key}=${value}`).join(" "), + ); + } // terminator after all parameters were writter writer.addCString("");