|
6 | 6 | use warnings;
|
7 | 7 | use PostgresNode;
|
8 | 8 | use TestLib;
|
9 |
| -use Test::More tests => 8; |
| 9 | +use Test::More tests => 9; |
10 | 10 |
|
11 | 11 | # Bug #15114
|
12 | 12 |
|
|
299 | 299 | $node_publisher->stop('fast');
|
300 | 300 | $node_subscriber->stop('fast');
|
301 | 301 |
|
302 |
| -# The bug was that when the REPLICA IDENTITY FULL is used with dropped columns, |
303 |
| -# we fail to apply updates and deletes |
| 302 | +# The bug was that when the REPLICA IDENTITY FULL is used with dropped or |
| 303 | +# generated columns, we fail to apply updates and deletes |
304 | 304 | my $node_publisher_d_cols = get_new_node('node_publisher_d_cols');
|
305 | 305 | $node_publisher_d_cols->init(allows_streaming => 'logical');
|
306 | 306 | $node_publisher_d_cols->start;
|
|
313 | 313 | 'postgres', qq(
|
314 | 314 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
315 | 315 | ALTER TABLE dropped_cols REPLICA IDENTITY FULL;
|
316 |
| - CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols; |
| 316 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
| 317 | + ALTER TABLE generated_cols REPLICA IDENTITY FULL; |
| 318 | + CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols, generated_cols; |
317 | 319 | -- some initial data
|
318 | 320 | INSERT INTO dropped_cols VALUES (1, 1, 1);
|
| 321 | + INSERT INTO generated_cols (a, c) VALUES (1, 1); |
319 | 322 | ));
|
320 | 323 |
|
321 | 324 | $node_subscriber_d_cols->safe_psql(
|
322 | 325 | 'postgres', qq(
|
323 | 326 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
| 327 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
324 | 328 | ));
|
325 | 329 |
|
326 | 330 | my $publisher_connstr_d_cols =
|
|
342 | 346 | $node_publisher_d_cols->safe_psql(
|
343 | 347 | 'postgres', qq(
|
344 | 348 | UPDATE dropped_cols SET a = 100;
|
| 349 | + UPDATE generated_cols SET a = 100; |
345 | 350 | ));
|
346 | 351 | $node_publisher_d_cols->wait_for_catchup('sub_dropped_cols');
|
347 | 352 |
|
|
350 | 355 | qq(1),
|
351 | 356 | 'replication with RI FULL and dropped columns');
|
352 | 357 |
|
| 358 | +is( $node_subscriber_d_cols->safe_psql( |
| 359 | + 'postgres', "SELECT count(*) FROM generated_cols WHERE a = 100"), |
| 360 | + qq(1), |
| 361 | + 'replication with RI FULL and generated columns'); |
| 362 | + |
353 | 363 | $node_publisher_d_cols->stop('fast');
|
354 | 364 | $node_subscriber_d_cols->stop('fast');
|
0 commit comments