|
3 | 3 | use warnings;
|
4 | 4 | use PostgresNode;
|
5 | 5 | use TestLib;
|
6 |
| -use Test::More tests => 15; |
| 6 | +use Test::More tests => 16; |
7 | 7 |
|
8 | 8 | # Initialize publisher node
|
9 | 9 | my $node_publisher = get_new_node('publisher');
|
|
22 | 22 | "CREATE TABLE tab_ins AS SELECT generate_series(1,1002) AS a");
|
23 | 23 | $node_publisher->safe_psql('postgres',
|
24 | 24 | "CREATE TABLE tab_full AS SELECT generate_series(1,10) AS a");
|
| 25 | +$node_publisher->safe_psql('postgres', |
| 26 | + "CREATE TABLE tab_full2 (x text)"); |
| 27 | +$node_publisher->safe_psql('postgres', |
| 28 | + "INSERT INTO tab_full2 VALUES ('a'), ('b'), ('b')"); |
25 | 29 | $node_publisher->safe_psql('postgres',
|
26 | 30 | "CREATE TABLE tab_rep (a int primary key)");
|
27 | 31 | $node_publisher->safe_psql('postgres',
|
|
33 | 37 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)");
|
34 | 38 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_ins (a int)");
|
35 | 39 | $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full (a int)");
|
| 40 | +$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)"); |
36 | 41 | $node_subscriber->safe_psql('postgres',
|
37 | 42 | "CREATE TABLE tab_rep (a int primary key)");
|
38 | 43 | # different column count and order than on publisher
|
|
45 | 50 | $node_publisher->safe_psql('postgres',
|
46 | 51 | "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)");
|
47 | 52 | $node_publisher->safe_psql('postgres',
|
48 |
| - "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_mixed"); |
| 53 | + "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed"); |
49 | 54 | $node_publisher->safe_psql('postgres',
|
50 | 55 | "ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins");
|
51 | 56 |
|
|
108 | 113 | "ALTER TABLE tab_full REPLICA IDENTITY FULL");
|
109 | 114 | $node_subscriber->safe_psql('postgres',
|
110 | 115 | "ALTER TABLE tab_full REPLICA IDENTITY FULL");
|
| 116 | +$node_publisher->safe_psql('postgres', |
| 117 | + "ALTER TABLE tab_full2 REPLICA IDENTITY FULL"); |
| 118 | +$node_subscriber->safe_psql('postgres', |
| 119 | + "ALTER TABLE tab_full2 REPLICA IDENTITY FULL"); |
111 | 120 | $node_publisher->safe_psql('postgres',
|
112 | 121 | "ALTER TABLE tab_ins REPLICA IDENTITY FULL");
|
113 | 122 | $node_subscriber->safe_psql('postgres',
|
114 | 123 | "ALTER TABLE tab_ins REPLICA IDENTITY FULL");
|
115 | 124 |
|
116 |
| -# and do the update |
| 125 | +# and do the updates |
117 | 126 | $node_publisher->safe_psql('postgres', "UPDATE tab_full SET a = a * a");
|
| 127 | +$node_publisher->safe_psql('postgres', "UPDATE tab_full2 SET x = 'bb' WHERE x = 'b'"); |
118 | 128 |
|
119 | 129 | # Wait for subscription to catch up
|
120 | 130 | $node_publisher->poll_query_until('postgres', $caughtup_query)
|
|
125 | 135 | is($result, qq(20|1|100),
|
126 | 136 | 'update works with REPLICA IDENTITY FULL and duplicate tuples');
|
127 | 137 |
|
| 138 | +$result = $node_subscriber->safe_psql('postgres', |
| 139 | + "SELECT x FROM tab_full2 ORDER BY 1"); |
| 140 | +is($result, qq(a |
| 141 | +bb |
| 142 | +bb), |
| 143 | + 'update works with REPLICA IDENTITY FULL and text datums'); |
| 144 | + |
128 | 145 | # check that change of connection string and/or publication list causes
|
129 | 146 | # restart of subscription workers. Not all of these are registered as tests
|
130 | 147 | # as we need to poll for a change but the test suite will fail none the less
|
|
0 commit comments