diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-03-24 12:13:32 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2025-03-24 12:13:32 +0200 |
commit | 19c6eb06c51f4da70e2ea0f1bdb64a0142e8e2aa (patch) | |
tree | af027f8218c6b4ee9834aa2c91d01c55e9d2e01a | |
parent | 73eba5004a06a744b6b8570e42432b9e9f75997b (diff) | |
download | postgresql-19c6eb06c51f4da70e2ea0f1bdb64a0142e8e2aa.tar.gz postgresql-19c6eb06c51f4da70e2ea0f1bdb64a0142e8e2aa.zip |
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
-rw-r--r-- | src/test/subscription/t/008_diff_schema.pl | 15 |
1 files changed, 15 insertions, 0 deletions
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; |