Search code examples
node.jspostgresqltransactionspg

client-initiated transactions that closed without COMMIT postgresql


I'm using pg in nodejs, my question is very basic but I can't find official documentation about it, what happens with a transaction that was started by a client that ended its connection without issuing COMMIT?

When there are transactions without confirmation, they simply do ROLLBACK when closing the connection of the client that gave BEGIN?


Solution

  • I actually find it documented nowhere, but if the connection is terminated before you commit, the transaction is automatically rolled back. That's a basic requirement for a relational database.