From 1ff1f58e0daee24b43e9a85f80acdec60a912094 Mon Sep 17 00:00:00 2001 From: Drew Cain Date: Thu, 1 Feb 2024 10:34:04 -0600 Subject: [PATCH] fix commit chaining --- 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);