From bd5092c0226be2bb9c072f835022fce0ebf19557 Mon Sep 17 00:00:00 2001 From: Shi Yu Date: Mon, 9 Jan 2023 16:53:07 +0800 Subject: [PATCH v1 2/2] Test for column list check in tablesync --- src/test/subscription/t/031_column_list.pl | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/subscription/t/031_column_list.pl b/src/test/subscription/t/031_column_list.pl index 8835ab30ff..3c9527f910 100644 --- a/src/test/subscription/t/031_column_list.pl +++ b/src/test/subscription/t/031_column_list.pl @@ -1184,6 +1184,35 @@ $result = $node_publisher->safe_psql( is( $result, qq(t t), 'check the number of columns in the old tuple'); +# TEST: With a table included in multiple publications with same column lists, +# it works fine. Generated columns are not considered. +$node_publisher->safe_psql( + 'postgres', qq( + CREATE TABLE test_mix_4 (a int PRIMARY KEY, b int, c int, d int GENERATED ALWAYS AS (a + 1) STORED); + + CREATE PUBLICATION pub_mix_7 FOR TABLE test_mix_4 (a, b, c); + CREATE PUBLICATION pub_mix_8 FOR TABLE test_mix_4; + + -- initial data + INSERT INTO test_mix_4 VALUES (1, 2, 3); +)); + +$node_subscriber->safe_psql( + 'postgres', qq( + DROP SUBSCRIPTION sub1; + CREATE TABLE test_mix_4 (a int PRIMARY KEY, b int, c int, d int); +)); + +$node_subscriber->safe_psql( + 'postgres', qq( + CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr' PUBLICATION pub_mix_7, pub_mix_8; +)); + +$node_subscriber->wait_for_subscription_sync; + +is( $node_subscriber->safe_psql('postgres', "SELECT * FROM test_mix_4 ORDER BY a"), + qq(1|2|3|), + 'replication with multiple publications with same column lists'); # TEST: With a table included in multiple publications with different column # lists, we should catch the error when creating the subscription. -- 2.31.1