|
|
|
|
|
by masklinn
810 days ago
|
|
> If `UPDATE player SET level = 'AA' WHERE team = 'Gophers';` is executed before the player swap, then why should "Stonebreaker" be upgraded to "AA"? I'd be pretty mad at my database if I sent those 2 queries in sequence and my DB decided to re-order them. It’s easy to miss but in the swap query the levels also get swapped. Because — and it’s harder to miss but easy to skip over — given what constraint 2 says the level is actually a team level, not a player level. So in a seqcst view, either the team’s players get upgraded to AA then the players’ levels get swapped during the exchange, or the players get exchanged then the team’s players get upgraded. In both sequences you end up with Stonebaker as an AA gopher and Lamport as an A dolphin. |
|
Then it's bad unnormalized data design that is the problem here. If that is a team level, it should be in the team table, not the player table.