Skip to content

Commit a9fd34f

Browse files
committedApr 3, 2025··
Revert "docs: fix bug in transaction example (#3414)"
This reverts commit dcb4257. The change doesn’t fix the bug it claims to (`finally` always runs) and introduces a resource leak if the `ROLLBACK` query fails. The related bug that a broken client can be returned to the pool remains unaffected either way.
1 parent a5d03a0 commit a9fd34f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎docs/pages/features/transactions.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ try {
3131
const insertPhotoValues = [res.rows[0].id, 's3.bucket.foo']
3232
await client.query(insertPhotoText, insertPhotoValues)
3333
await client.query('COMMIT')
34-
client.release()
3534
} catch (e) {
3635
await client.query('ROLLBACK')
37-
client.release()
3836
throw e
37+
} finally {
38+
client.release()
3939
}
4040
```

0 commit comments

Comments
 (0)
Please sign in to comment.