From c4254c6490223557d7e434962d585bc158dfcade Mon Sep 17 00:00:00 2001
From: Peter Smith <peter.b.smith@fujitsu.com>
Date: Tue, 20 Aug 2024 12:46:13 +1000
Subject: [PATCH v2] Add missing test case

---
 src/test/subscription/t/008_diff_schema.pl | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl
index cf04f85..51ebfe0 100644
--- a/src/test/subscription/t/008_diff_schema.pl
+++ b/src/test/subscription/t/008_diff_schema.pl
@@ -118,6 +118,20 @@ is( $node_subscriber->safe_psql(
 	qq(1|1|1),
 	'check replicated inserts on subscriber');
 
+# Test if the expected error is reported when the subscriber table is missing
+# columns which were specified on the publisher table.
+
+$node_publisher->safe_psql('postgres', "CREATE TABLE test_tab3 (a int, b int, c int)");
+$node_subscriber->safe_psql('postgres', "CREATE TABLE test_tab3 (a int)");
+
+my $offset = -s $node_subscriber->logfile;
+
+$node_subscriber->safe_psql('postgres',
+	"ALTER SUBSCRIPTION tap_sub REFRESH PUBLICATION");
+
+$node_subscriber->wait_for_log(
+	qr/ERROR: ( [A-Z0-9]+:)? logical replication target relation "public.test_tab3" is missing replicated columns: "b", "c"/,
+	$offset);
 
 $node_subscriber->stop;
 $node_publisher->stop;
-- 
1.8.3.1

