...

/

Correctness

Correctness

Learn how to ensure correctness using isolation levels.

When using multiple statements, it’s necessary to set up the isolation level correctly. Also, the connection and transaction semantics of our code should be tightly controlled. Our code snippet here does neither because it uses a default isolation level setting and doesn’t focus on transactions.

Isolation levels in SQL

The SQL standard defines four isolation levels, and PostgreSQL implements three of them, leaving out dirty reads. The isolation level determines which side effects from other transactions our transaction is sensitive to. The PostgreSQL documentation section entitled ...