News for hackers. Stuff that matters.
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.
Re:Do, or do not. There is no try by peter422 on Saturday June 24, 2023 @09:04PM (#36464238)
Just run the whole operation in a transaction and verify whatever you need to verify before committing.
Re:Do, or do not. There is no try by Avery3R on Saturday June 24, 2023 @09:09PM (#36464263)
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.
Re:Do, or do not. There is no try by wnolens on Saturday June 24, 2023 @10:57PM (#36464778)
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.
Re:Do, or do not. There is no try by hybby on Saturday June 24, 2023 @09:04PM (#36464237)
maybe you could run the updates in a transaction that you could roll back if you were unhappy with the result?