aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-11-22 12:52:26 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2019-11-22 12:52:26 -0500
commitf67b173771a0525ff7f2010d2d57d63d7f546352 (patch)
tree80dd5919a1d6b2ace6d6d8e2c3e7cce64598c5ca
parent4d9ceb0018cc087e267f978c90917b3195542e22 (diff)
downloadpostgresql-f67b173771a0525ff7f2010d2d57d63d7f546352.tar.gz
postgresql-f67b173771a0525ff7f2010d2d57d63d7f546352.zip
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
-rw-r--r--src/test/subscription/t/001_rep_changes.pl31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl
index f2be0e21ea5..77a1560b23d 100644
--- a/src/test/subscription/t/001_rep_changes.pl
+++ b/src/test/subscription/t/001_rep_changes.pl
@@ -3,7 +3,7 @@ use strict;
use warnings;
use PostgresNode;
use TestLib;
-use Test::More tests => 20;
+use Test::More tests => 22;
# Initialize publisher node
my $node_publisher = get_new_node('publisher');
@@ -168,9 +168,38 @@ is( $result, qq(local|1.1|baz|1
local|2.2|bar|2),
'update works with different column order and subscriber local values');
+# check behavior with toasted values
+
+$node_publisher->safe_psql('postgres',
+ "UPDATE tab_mixed SET b = repeat('xyzzy', 100000) WHERE a = 2");
+
+$node_publisher->wait_for_catchup('tap_sub');
+
+$result = $node_subscriber->safe_psql('postgres',
+ "SELECT a, length(b), c, d FROM tab_mixed ORDER BY a");
+is( $result, qq(1|3|1.1|local
+2|500000|2.2|local),
+ 'update transmits large column value');
+
+$node_publisher->safe_psql('postgres',
+ "UPDATE tab_mixed SET c = 3.3 WHERE a = 2");
+
+$node_publisher->wait_for_catchup('tap_sub');
+
+$result = $node_subscriber->safe_psql('postgres',
+ "SELECT a, length(b), c, d FROM tab_mixed ORDER BY a");
+is( $result, qq(1|3|1.1|local
+2|500000|3.3|local),
+ 'update with non-transmitted large column value');
+
# check behavior with dropped columns
+# this update should get transmitted before the column goes away
+$node_publisher->safe_psql('postgres',
+ "UPDATE tab_mixed SET b = 'bar', c = 2.2 WHERE a = 2");
+
$node_publisher->safe_psql('postgres', "ALTER TABLE tab_mixed DROP COLUMN b");
+
$node_publisher->safe_psql('postgres',
"UPDATE tab_mixed SET c = 11.11 WHERE a = 1");