Bird
0
0

How do you correctly initiate a transaction with REPEATABLE READ isolation level in PostgreSQL?

easy📝 Syntax Q3 of 15
PostgreSQL - Transactions and Concurrency

How do you correctly initiate a transaction with REPEATABLE READ isolation level in PostgreSQL?

ASTART TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BSET TRANSACTION ISOLATION LEVEL REPEATABLE READ; BEGIN;
CBEGIN ISOLATION LEVEL REPEATABLE READ;
DBEGIN TRANSACTION REPEATABLE READ;
Step-by-Step Solution
Solution:
  1. Step 1: Recall PostgreSQL syntax

    PostgreSQL requires setting the isolation level before beginning the transaction or within the BEGIN statement.
  2. Step 2: Evaluate options

    SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; BEGIN; correctly sets the isolation level first, then begins the transaction. Options A and B are invalid syntax. BEGIN ISOLATION LEVEL REPEATABLE READ; is close but not valid in PostgreSQL.
  3. Final Answer:

    SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; BEGIN; -> Option B
  4. Quick Check:

    Set isolation level before BEGIN [OK]
Quick Trick: Set isolation level before BEGIN [OK]
Common Mistakes:
  • Using BEGIN with isolation level directly (unsupported syntax)
  • Omitting SET TRANSACTION before BEGIN
  • Confusing syntax with other DBMS

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes