forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit48e2b23
committed
Fix COMMIT/ROLLBACK AND CHAIN in the presence of subtransactions.
In older branches, COMMIT/ROLLBACK AND CHAIN failed to propagatethe current transaction's properties to the new transaction ifthere was any open subtransaction (unreleased savepoint).Instead, some previous transaction's properties would be restored.This is because the "if (s->chain)" check in CommitTransactionCommandexamined the wrong instance of the "chain" flag and falselyconcluded that it didn't need to save transaction properties.Our regression tests would have noticed this, except they usedidentical transaction properties for multiple tests in a row,so that the faulty behavior was not distinguishable from correctbehavior.Commit12d768e fixed the problem in v15 and later, but only ratheraccidentally, because I removed the "if (s->chain)" test to avoid acompiler warning, while not realizing that the warning was flagging areal bug.In v14 and before, remove the if-test and save transaction propertiesunconditionally; just as in the newer branches, that's not expensiveenough to justify thinking harder.Add the comment and extra regression test to v15 and later toforestall any future recurrence, but there's no live bug in thosebranches.Patch by me, per bug #18118 from Liu Xiang. Back-patch to v12 wherethe AND CHAIN feature was added.Discussion:https://postgr.es/m/18118-4b72fcbb903aace6@postgresql.org1 parentcca97ce commit48e2b23
File tree
3 files changed
+52
-0
lines changed- src
- backend/access/transam
- test/regress
- expected
- sql
3 files changed
+52
-0
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3036 | 3036 |
| |
3037 | 3037 |
| |
3038 | 3038 |
| |
| 3039 | + | |
3039 | 3040 |
| |
3040 | 3041 |
| |
3041 | 3042 |
| |
|
Lines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
852 | 852 |
| |
853 | 853 |
| |
854 | 854 |
| |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
855 | 895 |
| |
856 | 896 |
| |
857 | 897 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
489 | 489 |
| |
490 | 490 |
| |
491 | 491 |
| |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
492 | 503 |
| |
493 | 504 |
| |
494 | 505 |
| |
|
0 commit comments
Comments
(0)