|
3 | 3 | use warnings;
|
4 | 4 | use PostgresNode;
|
5 | 5 | use TestLib;
|
6 |
| -use Test::More tests => 6; |
| 6 | +use Test::More tests => 7; |
7 | 7 |
|
8 | 8 | # Bug #15114
|
9 | 9 |
|
|
180 | 180 | $node_publisher->stop('fast');
|
181 | 181 | $node_subscriber->stop('fast');
|
182 | 182 |
|
183 |
| -# The bug was that when the REPLICA IDENTITY FULL is used with dropped columns, |
184 |
| -# we fail to apply updates and deletes |
| 183 | +# The bug was that when the REPLICA IDENTITY FULL is used with dropped or |
| 184 | +# generated columns, we fail to apply updates and deletes |
185 | 185 | my $node_publisher_d_cols = get_new_node('node_publisher_d_cols');
|
186 | 186 | $node_publisher_d_cols->init(allows_streaming => 'logical');
|
187 | 187 | $node_publisher_d_cols->start;
|
|
194 | 194 | 'postgres', qq(
|
195 | 195 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
196 | 196 | ALTER TABLE dropped_cols REPLICA IDENTITY FULL;
|
197 |
| - CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols; |
| 197 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
| 198 | + ALTER TABLE generated_cols REPLICA IDENTITY FULL; |
| 199 | + CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols, generated_cols; |
198 | 200 | -- some initial data
|
199 | 201 | INSERT INTO dropped_cols VALUES (1, 1, 1);
|
| 202 | + INSERT INTO generated_cols (a, c) VALUES (1, 1); |
200 | 203 | ));
|
201 | 204 |
|
202 | 205 | $node_subscriber_d_cols->safe_psql(
|
203 | 206 | 'postgres', qq(
|
204 | 207 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
| 208 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
205 | 209 | ));
|
206 | 210 |
|
207 | 211 | my $publisher_connstr_d_cols =
|
|
224 | 228 | $node_publisher_d_cols->safe_psql(
|
225 | 229 | 'postgres', qq(
|
226 | 230 | UPDATE dropped_cols SET a = 100;
|
| 231 | + UPDATE generated_cols SET a = 100; |
227 | 232 | ));
|
228 | 233 | $node_publisher_d_cols->wait_for_catchup('sub_dropped_cols');
|
229 | 234 |
|
|
232 | 237 | qq(1),
|
233 | 238 | 'replication with RI FULL and dropped columns');
|
234 | 239 |
|
| 240 | +is( $node_subscriber_d_cols->safe_psql( |
| 241 | + 'postgres', "SELECT count(*) FROM generated_cols WHERE a = 100"), |
| 242 | + qq(1), |
| 243 | + 'replication with RI FULL and generated columns'); |
| 244 | + |
235 | 245 | $node_publisher_d_cols->stop('fast');
|
236 | 246 | $node_subscriber_d_cols->stop('fast');
|
0 commit comments