The workshop is played with two terminals open at the same time, one per till. Some blocks do not give the prompt back straight away: that is intended, a lock makes the other till wait, and the guide says when to switch to the other terminal. The validation checks that no stock has been inflated and that the stock_positif rule is still there. The sandbox lives for three hours.
Tip
Never calculate a stock on your side to write it afterwards: ask the database to take off one unit if there is one left, with stock = stock - 1 and AND stock > 0 in the WHERE, then read the counter. UPDATE 0 means out of stock. And to avoid deadlocks, always take the rows in the same order.
sql
transactions
concurrency
locks
isolation
deadlock
PostgreSQL: transactions, locks and deadlocks · MonPremierLab