|
370 | 370 | is( $result, qq(1
|
371 | 371 | 3), 'check data in subscriber sch2.t1 after schema rename');
|
372 | 372 |
|
| 373 | +# Again, drop replication state but not tables. |
| 374 | +$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION tap_sub_sch"); |
| 375 | +$node_publisher->safe_psql('postgres', "DROP PUBLICATION tap_pub_sch"); |
| 376 | + |
| 377 | +$node_publisher->stop('fast'); |
| 378 | +$node_subscriber->stop('fast'); |
| 379 | + |
| 380 | +# The bug was that when the REPLICA IDENTITY FULL is used with dropped columns, |
| 381 | +# we fail to apply updates and deletes |
| 382 | +$node_publisher->rotate_logfile(); |
| 383 | +$node_publisher->start(); |
| 384 | + |
| 385 | +$node_subscriber->rotate_logfile(); |
| 386 | +$node_subscriber->start(); |
| 387 | + |
| 388 | +$node_publisher->safe_psql( |
| 389 | + 'postgres', qq( |
| 390 | + CREATE TABLE dropped_cols (a int, b_drop int, c int); |
| 391 | + ALTER TABLE dropped_cols REPLICA IDENTITY FULL; |
| 392 | + CREATE PUBLICATION pub_dropped_cols FOR TABLE dropped_cols; |
| 393 | + -- some initial data |
| 394 | + INSERT INTO dropped_cols VALUES (1, 1, 1); |
| 395 | +)); |
| 396 | + |
| 397 | +$node_subscriber->safe_psql( |
| 398 | + 'postgres', qq( |
| 399 | + CREATE TABLE dropped_cols (a int, b_drop int, c int); |
| 400 | +)); |
| 401 | + |
| 402 | +$publisher_connstr = $node_publisher->connstr . ' dbname=postgres'; |
| 403 | +$node_subscriber->safe_psql('postgres', |
| 404 | + "CREATE SUBSCRIPTION sub_dropped_cols CONNECTION '$publisher_connstr' PUBLICATION pub_dropped_cols" |
| 405 | +); |
| 406 | +$node_subscriber->wait_for_subscription_sync; |
| 407 | + |
| 408 | +$node_publisher->safe_psql( |
| 409 | + 'postgres', qq( |
| 410 | + ALTER TABLE dropped_cols DROP COLUMN b_drop; |
| 411 | +)); |
| 412 | +$node_subscriber->safe_psql( |
| 413 | + 'postgres', qq( |
| 414 | + ALTER TABLE dropped_cols DROP COLUMN b_drop; |
| 415 | +)); |
| 416 | + |
| 417 | +$node_publisher->safe_psql( |
| 418 | + 'postgres', qq( |
| 419 | + UPDATE dropped_cols SET a = 100; |
| 420 | +)); |
| 421 | +$node_publisher->wait_for_catchup('sub_dropped_cols'); |
| 422 | + |
| 423 | +is( $node_subscriber->safe_psql( |
| 424 | + 'postgres', "SELECT count(*) FROM dropped_cols WHERE a = 100"), |
| 425 | + qq(1), |
| 426 | + 'replication with RI FULL and dropped columns'); |
| 427 | + |
373 | 428 | $node_publisher->stop('fast');
|
374 | 429 | $node_subscriber->stop('fast');
|
375 | 430 |
|
|
0 commit comments