postgres.git / summary / log / commit / refs
commit 19c6eb06c51f4da70e2ea0f1bdb64a0142e8e2aa
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Mon Mar 24 10:13:32 2025 +0000
First released in: 18.0
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
src/test/subscription/t/008_diff_schema.pl | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/test/subscription/t/008_diff_schema.pl b/src/test/subscription/t/008_diff_schema.pl
index f3bef1f36a7..d0d24f0eb96 100644
--- a/src/test/subscription/t/008_diff_schema.pl
+++ b/src/test/subscription/t/008_diff_schema.pl
@@ -118,6 +118,21 @@ 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;
[parent: 73eba5004a06]