From 128394a4ab83e0557688eff1ebb985b04d6b4a79 Mon Sep 17 00:00:00 2001 From: Drew Cain Date: Fri, 2 Feb 2024 07:01:45 -0600 Subject: [PATCH] fix commit chaining (#437) --- query/transaction.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/query/transaction.ts b/query/transaction.ts index 218816cf..a5088cfd 100644 --- a/query/transaction.ts +++ b/query/transaction.ts @@ -281,9 +281,11 @@ export class Transaction { const chain = options?.chain ?? false; if (!this.#committed) { - this.#committed = true; try { await this.queryArray(`COMMIT ${chain ? "AND CHAIN" : ""}`); + if (!chain) { + this.#committed = true; + } } catch (e) { if (e instanceof PostgresError) { throw new TransactionError(this.name, e);