5 ms·
> Why is the origin of this data not validating against the actual data from the DB before sending data? It's on the client side, so it can't hold an open tran
by lmm 5y ago
> Why is the origin of this data not validating against the actual data from the DB before sending data?
It's on the client side, so it can't hold an open transaction with the server. It can validate against a previous version of the list of cities, but there's always the possibility of a delete happening in parallel.
(And if your answer is to use a delete flag rather than actually deleting a row, then you're undermining the referential integrity constraints that were supposed to be the whole point of using a relational database)
- EdwardDiego 5y ago>It can validate against a previous version of the list of cities, but there's always the possibility of a delete happening in parallel. If a "city" is a) required attribute of an entity and b) required to exist as an entity itself, then deleting a city would require deleting all other entities that refer to that city. If city is a nullable attribute, then your validation issue you raised earlier is voided - an invalid "city" can just be replaced with null. Assuming you're wanting to delete cities, then your client side shouldn't be firing off data and assuming success. > It can validate against a previous version of the list of cities, but there's always the possibility of a delete happening in parallel. Yep, caching is hard, but your argument that "RDBMS aren't that great" is predicated on a very... ...convoluted system.
- lmm 5y ago> If a "city" is a) required attribute of an entity and b) required to exist as an entity itself, then deleting a city would require deleting all other entities that refer to that city. Right, so usually what people implement (and what the database enforces by default) is that you can't delete a city if there are any customers in that city. But they don't think about what happens when two people try to make changes in parallel, because the whole point of ACID is that each query runs in its own transaction. > Yep, caching is hard, but your argument that "RDBMS aren't that great" is predicated on a very... ...convoluted system. All the use cases for referential integrity - and transactionality - are like this though. You can't actually use them for anything, not with a web app where the client can't hold a transaction open.
- EdwardDiego 5y ago> All the use cases for referential integrity - and transactionality - are like this though. You can't actually use them for anything, not with a web app where the client can't hold a transaction open. You should probably tell the millions of companies actually using them for things that they're wrong. I'm sure they'll feel very silly.
- lmm 5y agoThe actual businesses generally don't. It's funny how RDBMS fans always say "businesses x, y and z were built on MySQL" and forget to mention that they were actually using MyISAM-based versions of MySQL that had no ACID and barely any referential integrity constraints. Most of the "mongodb is web scale" crowd is coming from the same ideology as the people who were hating on MySQL 10 years ago.
- kaba0 5y ago> But they don't think about what happens when two people try to make changes in parallel, because the whole point of ACID is that each query runs in its own transaction. You do know that the D in ACID stands for consistency? That is in case a transaction try to modify something that was already changed in a parallel transaction that was already committed, it will fail and will be rolled back (given proper transaction levels). So I really don’t understand your point. Also, you can hold a transaction open for a client..
- lmm 5y ago> That is in case a transaction try to modify something that was already changed in a parallel transaction that was already committed, it will fail and will be rolled back (given proper transaction levels). It will fail and be rolled back and you will lose the user's data that was written in it, unless you effectively build your own datastore on top of what the database offers. > Also, you can hold a transaction open for a client.. For a client that's potentially gone offline for an indefinite period? Certainly not. Even if you're heartbeating that the client still has the form open somehow, that seems like a very suspect architecture.