forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1b86c81
committed
Fix decoding of MULTI_INSERTs when rows other than the last are toasted.
When decoding the results of a HEAP2_MULTI_INSERT (currently onlygenerated by COPY FROM) toast columns for all but the last tupleweren't replaced by their actual contents before being handed to theoutput plugin. The reassembled toast datums where disregarded afterevery REORDER_BUFFER_CHANGE_(INSERT|UPDATE|DELETE) which is correctfor plain inserts, updates, deletes, but not multi inserts - there wegenerate several REORDER_BUFFER_CHANGE_INSERTs for a singlexl_heap_multi_insert record.To solve the problem add a clear_toast_afterwards boolean toReorderBufferChange's union member that's used by modifications. Allrow changes but multi_inserts always set that to true, butmulti_insert sets it only for the last change generated.Add a regression test covering decoding of multi_inserts - there wasnone at all before.Backpatch to 9.4 where logical decoding was introduced.Bug found by Petr Jelinek.1 parent333b7db commit1b86c81
File tree
5 files changed
+54
-2
lines changed- contrib/test_decoding
- expected
- sql
- src
- backend/replication/logical
- include/replication
5 files changed
+54
-2
lines changedLines changed: 19 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
43 | 51 |
| |
44 | 52 |
| |
45 | 53 |
| |
| |||
80 | 88 |
| |
81 | 89 |
| |
82 | 90 |
| |
83 |
| - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
84 | 102 |
| |
85 | 103 |
| |
86 | 104 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
47 | 47 |
| |
48 | 48 |
| |
49 | 49 |
| |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
50 | 63 |
| |
51 | 64 |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
608 | 608 |
| |
609 | 609 |
| |
610 | 610 |
| |
| 611 | + | |
| 612 | + | |
611 | 613 |
| |
612 | 614 |
| |
613 | 615 |
| |
| |||
673 | 675 |
| |
674 | 676 |
| |
675 | 677 |
| |
| 678 | + | |
| 679 | + | |
676 | 680 |
| |
677 | 681 |
| |
678 | 682 |
| |
| |||
710 | 714 |
| |
711 | 715 |
| |
712 | 716 |
| |
| 717 | + | |
| 718 | + | |
| 719 | + | |
713 | 720 |
| |
714 | 721 |
| |
715 | 722 |
| |
| |||
795 | 802 |
| |
796 | 803 |
| |
797 | 804 |
| |
| 805 | + | |
| 806 | + | |
| 807 | + | |
798 | 808 |
| |
799 | 809 |
| |
800 | 810 |
| |
|
Lines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1383 | 1383 |
| |
1384 | 1384 |
| |
1385 | 1385 |
| |
1386 |
| - | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
1387 | 1394 |
| |
1388 | 1395 |
| |
1389 | 1396 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
78 | 82 |
| |
79 | 83 |
| |
80 | 84 |
| |
|
0 commit comments
Comments
(0)