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

Commit 19c6eb0

Browse files
committed
Add test case for when subscriber table is missing a column
We haven't had bugs in this area, but there's some not-entirely trivial code to detect that case, so it seems good to have test coverage for it. Author: Peter Smith <smithpb2250@gmail.com> Reviewed-by: vignesh C <vignesh21@gmail.com> Reviewed-by: Tomas Vondra <tomas@vondra.me> Discussion: https://www.postgresql.org/message-id/CAHut%2BPtX8P0EGhsk9p%3DhQGUHrzxeCSzANXSMKOvYiLX-EjdyNw@mail.gmail.com
1 parent 73eba50 commit 19c6eb0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/test/subscription/t/008_diff_schema.pl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,21 @@
118118
qq(1|1|1),
119119
'check replicated inserts on subscriber');
120120

121+
# Test if the expected error is reported when the subscriber table is missing
122+
# columns which were specified on the publisher table.
123+
$node_publisher->safe_psql('postgres',
124+
"CREATE TABLE test_tab3 (a int, b int, c int)");
125+
$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tab3 (a int)");
126+
127+
my $offset = -s $node_subscriber->logfile;
128+
129+
$node_subscriber->safe_psql('postgres',
130+
"ALTER SUBSCRIPTION tap_sub REFRESH PUBLICATION");
131+
132+
$node_subscriber->wait_for_log(
133+
qr/ERROR: ( [A-Z0-9]+:)? logical replication target relation "public.test_tab3" is missing replicated columns: "b", "c"/,
134+
$offset);
135+
121136

122137
$node_subscriber->stop;
123138
$node_publisher->stop;

0 commit comments

Comments
 (0)