Is it possible to make a SELECT wait until an ongoing UPDATE finishes? Suppose that I am implementing a bank account logic using PostgreSQL. At some point, I will want to check if the user has sufficient balance to perform an operation. However, the user's balance might be in the middle of an UPDATE statement and, in my perception, any SELECT statements performed during this period will return the old balance. My questions are:


Is my perception correct, i.e. is it possible for the SELECT statement to get old data in this trivial scenario?
If yes, how do I implement locks to protect myself from this? I've read about FOR UPDATE in the docs, but I'm not sure it is meant for this specific situation.


Please assume that I cannot serialize the requests in the clients.
"sufficient balance to perform an operation", this should be one transaction, the check and the operation, otherwise the check is a waste of time.  Plenty could happen between check and operation, if you separate them.