Hacker News new | past | comments | ask | show | jobs | submit login

> Postgres doesn’t have a concept of nested transactions

It has savepoints and those nest fine.

(perl's DBIx::Class can be configured to automatically convert transactions into savepoints if it's already inside another transaction; presumably any other ORM-like thing could also do that for you in theory but whether the one you're currently using -does- is left as an exercise to the reader)




beware of the issues related to postgres subtransactions https://postgres.ai/blog/20210831-postgresql-subtransactions...


Solid list of ways to shoot yourself in the foot with it, even if "use savepoints in moderation" is, for a suitable value of "moderation", sufficient to largely avoid them. (though if you're going to use them, read the article and maybe some of the things it links anyway to calibrate your sense of suitable)

And that article also lists a bunch of ORMs that handle subtransactions out of the box, for anybody curious.


Django does this too




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: