|
3 | 3 | use warnings;
|
4 | 4 | use PostgresNode;
|
5 | 5 | use TestLib;
|
6 |
| -use Test::More tests => 21; |
| 6 | +use Test::More tests => 22; |
7 | 7 |
|
8 | 8 | # Initialize publisher node
|
9 | 9 | my $node_publisher = get_new_node('publisher');
|
|
31 | 31 | "CREATE TABLE tab_mixed (a int primary key, b text, c numeric)");
|
32 | 32 | $node_publisher->safe_psql('postgres',
|
33 | 33 | "INSERT INTO tab_mixed (a, b, c) VALUES (1, 'foo', 1.1)");
|
| 34 | +# Let this table with REPLICA IDENTITY NOTHING, allowing only INSERT changes. |
| 35 | +$node_publisher->safe_psql('postgres', "CREATE TABLE tab_nothing (a int)"); |
| 36 | +$node_publisher->safe_psql('postgres', |
| 37 | + "ALTER TABLE tab_nothing REPLICA IDENTITY NOTHING"); |
34 | 38 |
|
35 | 39 | # Setup structure on subscriber
|
36 | 40 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)");
|
|
39 | 43 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)");
|
40 | 44 | $node_subscriber->safe_psql('postgres',
|
41 | 45 | "CREATE TABLE tab_rep (a int primary key)");
|
| 46 | +$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_nothing (a int)"); |
42 | 47 |
|
43 | 48 | # different column count and order than on publisher
|
44 | 49 | $node_subscriber->safe_psql('postgres',
|
|
51 | 56 | $node_publisher->safe_psql('postgres',
|
52 | 57 | "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)");
|
53 | 58 | $node_publisher->safe_psql('postgres',
|
54 |
| -"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed" |
| 59 | +"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed, tab_nothing" |
55 | 60 | );
|
56 | 61 | $node_publisher->safe_psql('postgres',
|
57 | 62 | "ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins");
|
|
94 | 99 | $node_publisher->safe_psql('postgres',
|
95 | 100 | "INSERT INTO tab_mixed VALUES (2, 'bar', 2.2)");
|
96 | 101 |
|
| 102 | +$node_publisher->safe_psql('postgres', |
| 103 | + "INSERT INTO tab_nothing VALUES (generate_series(1,20))"); |
| 104 | + |
97 | 105 | $node_publisher->poll_query_until('postgres', $caughtup_query)
|
98 | 106 | or die "Timed out while waiting for subscriber to catch up";
|
99 | 107 |
|
|
109 | 117 | is( $result, qq(local|1.1|foo|1
|
110 | 118 | local|2.2|bar|2), 'check replicated changes with different column order');
|
111 | 119 |
|
| 120 | +$result = |
| 121 | + $node_subscriber->safe_psql('postgres', "SELECT count(*) FROM tab_nothing"); |
| 122 | +is($result, qq(20), 'check replicated changes with REPLICA IDENTITY NOTHING'); |
| 123 | + |
112 | 124 | # insert some duplicate rows
|
113 | 125 | $node_publisher->safe_psql('postgres',
|
114 | 126 | "INSERT INTO tab_full SELECT generate_series(1,10)");
|
|
0 commit comments