1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

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
This commit is contained in:
Heikki Linnakangas
2025-03-24 12:13:32 +02:00
parent 73eba5004a
commit 19c6eb06c5

View File

@ -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;