|
3 | 3 | use warnings; |
4 | 4 | use PostgresNode; |
5 | 5 | use TestLib; |
6 | | -use Test::More tests => 22; |
| 6 | +use Test::More tests => 23; |
7 | 7 |
|
8 | 8 | # Initialize publisher node |
9 | 9 | my $node_publisher = get_new_node('publisher'); |
|
34 | 34 | $node_publisher->safe_psql('postgres', |
35 | 35 | "CREATE TABLE tab_include (a int, b text, CONSTRAINT covering PRIMARY KEY(a) INCLUDE(b))" |
36 | 36 | ); |
| 37 | +# Let this table with REPLICA IDENTITY NOTHING, allowing only INSERT changes. |
| 38 | +$node_publisher->safe_psql('postgres', "CREATE TABLE tab_nothing (a int)"); |
| 39 | +$node_publisher->safe_psql('postgres', |
| 40 | + "ALTER TABLE tab_nothing REPLICA IDENTITY NOTHING"); |
37 | 41 |
|
38 | 42 | # Setup structure on subscriber |
39 | 43 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)"); |
|
42 | 46 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)"); |
43 | 47 | $node_subscriber->safe_psql('postgres', |
44 | 48 | "CREATE TABLE tab_rep (a int primary key)"); |
| 49 | +$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_nothing (a int)"); |
45 | 50 |
|
46 | 51 | # different column count and order than on publisher |
47 | 52 | $node_subscriber->safe_psql('postgres', |
|
59 | 64 | $node_publisher->safe_psql('postgres', |
60 | 65 | "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)"); |
61 | 66 | $node_publisher->safe_psql('postgres', |
62 | | - "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed, tab_include" |
| 67 | + "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed, tab_include, tab_nothing" |
63 | 68 | ); |
64 | 69 | $node_publisher->safe_psql('postgres', |
65 | 70 | "ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins"); |
|
97 | 102 | $node_publisher->safe_psql('postgres', |
98 | 103 | "INSERT INTO tab_mixed VALUES (2, 'bar', 2.2)"); |
99 | 104 |
|
| 105 | +$node_publisher->safe_psql('postgres', |
| 106 | + "INSERT INTO tab_nothing VALUES (generate_series(1,20))"); |
| 107 | + |
100 | 108 | $node_publisher->safe_psql('postgres', |
101 | 109 | "INSERT INTO tab_include SELECT generate_series(1,50)"); |
102 | 110 | $node_publisher->safe_psql('postgres', |
|
117 | 125 | is( $result, qq(local|1.1|foo|1 |
118 | 126 | local|2.2|bar|2), 'check replicated changes with different column order'); |
119 | 127 |
|
| 128 | +$result = |
| 129 | + $node_subscriber->safe_psql('postgres', "SELECT count(*) FROM tab_nothing"); |
| 130 | +is($result, qq(20), 'check replicated changes with REPLICA IDENTITY NOTHING'); |
| 131 | + |
120 | 132 | $result = $node_subscriber->safe_psql('postgres', |
121 | 133 | "SELECT count(*), min(a), max(a) FROM tab_include"); |
122 | 134 | is($result, qq(20|-20|-1), |
|
0 commit comments