Commit 89fbd77
committed
fix: Throw
Automatically reconnecting for an in-transaction queries is not supported, as
we’d have to replay all previous queries and still risk inconsistency if any
subsequently issued application queries depended on data previously read during
the disconnected transaction.
We’d *also* have to keep a log of all previously returned data to verify that
it hasn’t changed when reissuing the command – an unacceptable overhead,
particularly since applications must be able to handle transaction conflicts
anyway and this patch just makes disconnects look like any other
“please retry transaction” condition.
This commit also:
* Removes useless `try…catch` blocks around function calls already containing
an equivalent `try…catch` block and hence never catching anything.
* Replaces calls to `commit()` in error handling with `rollback()` as
`COMMIT`ing after an putting a transaction into an “aborted” state actually
issues a `ROLLBACK` internally in PostgreSQL (probably some arcane
compatiblity thing with software like this one), but using the wrong
terminology is highly confusing. (*Actually* committing would risk applying
inconsistent changes, resulting in data corruption!)TransactionError if database was disconnected when issuing transaction command1 parent 412bbfb commit 89fbd77
1 file changed
Lines changed: 20 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
282 | 284 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | 285 | | |
287 | 286 | | |
288 | 287 | | |
| |||
333 | 332 | | |
334 | 333 | | |
335 | 334 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
346 | 338 | | |
347 | 339 | | |
348 | 340 | | |
| |||
513 | 505 | | |
514 | 506 | | |
515 | 507 | | |
516 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
517 | 514 | | |
518 | 515 | | |
519 | 516 | | |
| |||
615 | 612 | | |
616 | 613 | | |
617 | 614 | | |
618 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
619 | 621 | | |
620 | 622 | | |
621 | 623 | | |
| |||
755 | 757 | | |
756 | 758 | | |
757 | 759 | | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
| 760 | + | |
767 | 761 | | |
768 | 762 | | |
769 | 763 | | |
| |||
857 | 851 | | |
858 | 852 | | |
859 | 853 | | |
860 | | - | |
861 | | - | |
| 854 | + | |
862 | 855 | | |
863 | 856 | | |
864 | 857 | | |
| |||
874 | 867 | | |
875 | 868 | | |
876 | 869 | | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
| 870 | + | |
886 | 871 | | |
887 | 872 | | |
888 | 873 | | |
| |||
0 commit comments