|
377 | 377 | $node_publisher->stop('fast');
|
378 | 378 | $node_subscriber->stop('fast');
|
379 | 379 |
|
380 |
| -# The bug was that when the REPLICA IDENTITY FULL is used with dropped columns, |
381 |
| -# we fail to apply updates and deletes |
| 380 | +# The bug was that when the REPLICA IDENTITY FULL is used with dropped or |
| 381 | +# generated columns, we fail to apply updates and deletes |
382 | 382 | $node_publisher->rotate_logfile();
|
383 | 383 | $node_publisher->start();
|
384 | 384 |
|
|
389 | 389 | 'postgres', qq(
|
390 | 390 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
391 | 391 | ALTER TABLE dropped_cols REPLICA IDENTITY FULL;
|
392 |
| - CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols; |
| 392 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
| 393 | + ALTER TABLE generated_cols REPLICA IDENTITY FULL; |
| 394 | + CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols, generated_cols; |
393 | 395 | -- some initial data
|
394 | 396 | INSERT INTO dropped_cols VALUES (1, 1, 1);
|
| 397 | + INSERT INTO generated_cols (a, c) VALUES (1, 1); |
395 | 398 | ));
|
396 | 399 |
|
397 | 400 | $node_subscriber->safe_psql(
|
398 | 401 | 'postgres', qq(
|
399 | 402 | CREATE TABLE dropped_cols (a int, b_drop int, c int);
|
| 403 | + CREATE TABLE generated_cols (a int, b_gen int GENERATED ALWAYS AS (5 * a) STORED, c int); |
400 | 404 | ));
|
401 | 405 |
|
402 | 406 | $publisher_connstr = $node_publisher->connstr . ' dbname=postgres';
|
|
417 | 421 | $node_publisher->safe_psql(
|
418 | 422 | 'postgres', qq(
|
419 | 423 | UPDATE dropped_cols SET a = 100;
|
| 424 | + UPDATE generated_cols SET a = 100; |
420 | 425 | ));
|
421 | 426 | $node_publisher->wait_for_catchup('sub_dropped_cols');
|
422 | 427 |
|
|
425 | 430 | qq(1),
|
426 | 431 | 'replication with RI FULL and dropped columns');
|
427 | 432 |
|
| 433 | +is( $node_subscriber->safe_psql( |
| 434 | + 'postgres', "SELECT count(*) FROM generated_cols WHERE a = 100"), |
| 435 | + qq(1), |
| 436 | + 'replication with RI FULL and generated columns'); |
| 437 | + |
428 | 438 | $node_publisher->stop('fast');
|
429 | 439 | $node_subscriber->stop('fast');
|
430 | 440 |
|
|
0 commit comments