hard20 pts · first answer countsdatabasestransactionsconnection-pooling
A transaction spread across connections
Using node-postgres, this 'transaction' sometimes commits half the work. Why?
await pool.query('BEGIN')
await pool.query('UPDATE accounts SET bal = bal - 100 WHERE id = 1')
await pool.query('UPDATE accounts SET bal = bal + 100 WHERE id = 2')
await pool.query('COMMIT')Discussion 0
Join free to post in the discussion.
Related questions
- Atomicity in a money transferBackend Developer
- Building SQL from user inputBackend Developer
- What atomicity guaranteesBackend Developer
- WHERE column = NULL finds nothingBackend Developer
- COUNT(*) versus COUNT(column)Backend Developer
- Column type for pricesBackend Developer
- Storing order times for two countriesBackend Developer
- Students and courses table designBackend Developer