Commit 544c69b
committed
fix: Do not attempt to commit partial transactions on error
Committing partial transactions is a great way to induce data corruption by committing inconsistent data to the database. Transaction MUST always form a unit!
Fortunately, this probably never mattered in practice as PostgreSQL will put transactions with failed commands into an *aborted* state, where the only valid subsequent in-transaction command is rolling back partially or completely:
> […] Moreover, ROLLBACK TO is the only way to regain control of a transaction block that was put in aborted state by the system due to an error, short of rolling it back completely and starting again.
https://www.postgresql.org/docs/current/tutorial-transactions.html
So this “only” improves error messages and avoids an unnecessary round trip, not change application observable behaviour.1 parent c7a64f3 commit 544c69b
1 file changed
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
513 | 513 | | |
514 | 514 | | |
515 | 515 | | |
516 | | - | |
517 | 516 | | |
518 | 517 | | |
519 | 518 | | |
| |||
615 | 614 | | |
616 | 615 | | |
617 | 616 | | |
618 | | - | |
619 | 617 | | |
620 | 618 | | |
621 | 619 | | |
| |||
759 | 757 | | |
760 | 758 | | |
761 | 759 | | |
762 | | - | |
763 | 760 | | |
764 | 761 | | |
765 | 762 | | |
| |||
858 | 855 | | |
859 | 856 | | |
860 | 857 | | |
861 | | - | |
862 | 858 | | |
863 | 859 | | |
864 | 860 | | |
| |||
878 | 874 | | |
879 | 875 | | |
880 | 876 | | |
881 | | - | |
882 | 877 | | |
883 | 878 | | |
884 | 879 | | |
| |||
0 commit comments