Commit d85655f
authored
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 4fef468 commit d85655f
1 file changed
Lines changed: 0 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
514 | | - | |
515 | 514 | | |
516 | 515 | | |
517 | 516 | | |
| |||
613 | 612 | | |
614 | 613 | | |
615 | 614 | | |
616 | | - | |
617 | 615 | | |
618 | 616 | | |
619 | 617 | | |
| |||
757 | 755 | | |
758 | 756 | | |
759 | 757 | | |
760 | | - | |
761 | 758 | | |
762 | 759 | | |
763 | 760 | | |
| |||
856 | 853 | | |
857 | 854 | | |
858 | 855 | | |
859 | | - | |
860 | 856 | | |
861 | 857 | | |
862 | 858 | | |
| |||
876 | 872 | | |
877 | 873 | | |
878 | 874 | | |
879 | | - | |
880 | 875 | | |
881 | 876 | | |
882 | 877 | | |
| |||
0 commit comments