Commit 6f1b9aa
committed
Fix logical replication between different encodings
When sending a tuple attribute, the previous coding erroneously sent the
length byte before encoding conversion, which would lead to protocol
failures on the receiving side if the length did not match the following
string.
To fix that, use pq_sendcountedtext() for sending tuple attributes,
which takes care of all of that internally. To match the API of
pq_sendcountedtext(), send even text values without a trailing zero byte
and have the receiving end put it in place instead. This matches how
the standard FE/BE protocol behaves.
Reported-by: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>1 parent 5f21f52 commit 6f1b9aa
File tree
3 files changed
+55
-8
lines changed- doc/src/sgml
- src
- backend/replication/logical
- test/subscription/t
3 files changed
+55
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6107 | 6107 | | |
6108 | 6108 | | |
6109 | 6109 | | |
6110 | | - | |
| 6110 | + | |
6111 | 6111 | | |
6112 | 6112 | | |
6113 | 6113 | | |
6114 | | - | |
| 6114 | + | |
| 6115 | + | |
| 6116 | + | |
| 6117 | + | |
6115 | 6118 | | |
6116 | 6119 | | |
6117 | 6120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
420 | | - | |
421 | 420 | | |
422 | 421 | | |
423 | 422 | | |
| |||
442 | 441 | | |
443 | 442 | | |
444 | 443 | | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 444 | + | |
449 | 445 | | |
450 | 446 | | |
451 | 447 | | |
| |||
492 | 488 | | |
493 | 489 | | |
494 | 490 | | |
495 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
496 | 494 | | |
497 | 495 | | |
498 | 496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
0 commit comments