Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f67b173

Browse files
committed
Add test coverage for "unchanged toast column" replication code path.
It seems pretty unacceptable to have no regression test coverage for this aspect of the logical replication protocol, especially given the bugs we've found in related code. Discussion: https://postgr.es/m/16129-a0c0f48e71741e5f@postgresql.org
1 parent 4d9ceb0 commit f67b173

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

src/test/subscription/t/001_rep_changes.pl

+30-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use warnings;
44
use PostgresNode;
55
use TestLib;
6-
use Test::More tests => 20;
6+
use Test::More tests => 22;
77

88
# Initialize publisher node
99
my $node_publisher = get_new_node('publisher');
@@ -168,9 +168,38 @@
168168
local|2.2|bar|2),
169169
'update works with different column order and subscriber local values');
170170

171+
# check behavior with toasted values
172+
173+
$node_publisher->safe_psql('postgres',
174+
"UPDATE tab_mixed SET b = repeat('xyzzy', 100000) WHERE a = 2");
175+
176+
$node_publisher->wait_for_catchup('tap_sub');
177+
178+
$result = $node_subscriber->safe_psql('postgres',
179+
"SELECT a, length(b), c, d FROM tab_mixed ORDER BY a");
180+
is( $result, qq(1|3|1.1|local
181+
2|500000|2.2|local),
182+
'update transmits large column value');
183+
184+
$node_publisher->safe_psql('postgres',
185+
"UPDATE tab_mixed SET c = 3.3 WHERE a = 2");
186+
187+
$node_publisher->wait_for_catchup('tap_sub');
188+
189+
$result = $node_subscriber->safe_psql('postgres',
190+
"SELECT a, length(b), c, d FROM tab_mixed ORDER BY a");
191+
is( $result, qq(1|3|1.1|local
192+
2|500000|3.3|local),
193+
'update with non-transmitted large column value');
194+
171195
# check behavior with dropped columns
172196

197+
# this update should get transmitted before the column goes away
198+
$node_publisher->safe_psql('postgres',
199+
"UPDATE tab_mixed SET b = 'bar', c = 2.2 WHERE a = 2");
200+
173201
$node_publisher->safe_psql('postgres', "ALTER TABLE tab_mixed DROP COLUMN b");
202+
174203
$node_publisher->safe_psql('postgres',
175204
"UPDATE tab_mixed SET c = 11.11 WHERE a = 1");
176205

0 commit comments

Comments
 (0)