Re:Do, or do not. There is no try
by jagtstronaut on Saturday June 24, 2023 @09:02PM
(#36464229)
Maybe there is already something like this but this would be sick for sql DBs. Having to make prod updates to a table always terrifies me.
[ Parent
| on HN ]
Just run the whole operation in a transaction and verify whatever you need to verify before committing.
BEGIN TRANSACTION;
... ; Modify DB
... ; Inspect State
ROLLBACK TRANSACTION;
and then switch the rollback to commit when satisfied
Re:Do, or do not. There is no try
by jagtstronaut on Saturday June 24, 2023 @09:39PM
(#36464403)
This is cool I probably will do this.
Just mind the isolation level of concurrent queries which may be running. By default you are probably fine since it's usually snapshot isolation mode (will only see committed results as of query start) but there are other modes that break this.