row-filter-test.txt
text/plain
Filename: row-filter-test.txt
Type: text/plain
Part: 0
diff --git a/src/test/subscription/t/028_row_filter.pl b/src/test/subscription/t/028_row_filter.pl
index 89bb364e9da..333895e081b 100644
--- a/src/test/subscription/t/028_row_filter.pl
+++ b/src/test/subscription/t/028_row_filter.pl
@@ -691,6 +691,75 @@ is($result, qq(t|1), 'check replicated rows to tab_rowfilter_toast');
# Testcase end: FOR TABLE with row filter publications
# ======================================================
+$node_publisher->safe_psql('postgres', qq(
+ CREATE TABLE test_part_rf (a int primary key, b int, c int) PARTITION BY LIST (a);
+ CREATE TABLE test_part_rf_1 PARTITION OF test_part_rf FOR VALUES IN (1,2,3,4,5) PARTITION BY LIST (a);
+ CREATE TABLE test_part_rf_2 PARTITION OF test_part_rf_1 FOR VALUES IN (1,2,3,4,5);
+
+ CREATE PUBLICATION test_pub_part_1 FOR TABLE test_part_rf_1 WHERE (b < 10) WITH (publish_via_partition_root);
+ CREATE PUBLICATION test_pub_part_2 FOR TABLE test_part_rf_2 WHERE (b > 10) WITH (publish_via_partition_root);
+
+ INSERT INTO test_part_rf VALUES (1, 5, 100);
+ INSERT INTO test_part_rf VALUES (2, 15, 200);
+));
+
+$node_subscriber->safe_psql('postgres', qq(
+ CREATE TABLE test_part_rf (a int primary key, b int, c int) PARTITION BY LIST (a);
+ CREATE TABLE test_part_rf_1 PARTITION OF test_part_rf FOR VALUES IN (1,2,3,4,5) PARTITION BY LIST (a);
+ CREATE TABLE test_part_rf_2 PARTITION OF test_part_rf_1 FOR VALUES IN (1,2,3,4,5);
+
+ CREATE SUBSCRIPTION test_part_sub CONNECTION '$publisher_connstr' PUBLICATION test_pub_part_1, test_pub_part_2;
+));
+
+$node_subscriber->poll_query_until('postgres', $synced_query)
+ or die "Timed out while waiting for subscriber to synchronize data";
+
+$node_publisher->safe_psql('postgres', qq(
+ INSERT INTO test_part_rf VALUES (3, 6, 300);
+ INSERT INTO test_part_rf VALUES (4, 16, 400);
+));
+
+$node_publisher->wait_for_catchup('test_part_sub');
+
+$result = $node_subscriber->safe_psql('postgres', qq(SELECT * FROM test_part_rf ORDER BY a));
+is($result,
+ qq(1|5|100
+3|6|300), 'check replicated rows with multiple row filters');
+
+
+$node_publisher->safe_psql('postgres',
+ qq(TRUNCATE test_part_rf));
+
+$node_publisher->wait_for_catchup('test_part_sub');
+
+$node_subscriber->safe_psql('postgres', qq(
+ DROP SUBSCRIPTION test_part_sub));
+
+$node_publisher->safe_psql('postgres', qq(
+ INSERT INTO test_part_rf VALUES (1, 5, 100);
+ INSERT INTO test_part_rf VALUES (2, 15, 200);
+));
+
+$node_subscriber->safe_psql('postgres', qq(
+ CREATE SUBSCRIPTION test_part_sub CONNECTION '$publisher_connstr' PUBLICATION test_pub_part_2, test_pub_part_1;
+));
+
+$node_subscriber->poll_query_until('postgres', $synced_query)
+ or die "Timed out while waiting for subscriber to synchronize data";
+
+$node_publisher->safe_psql('postgres', qq(
+ TRUNCATE test_part_rf;
+ INSERT INTO test_part_rf VALUES (3, 6, 300);
+ INSERT INTO test_part_rf VALUES (4, 16, 400);
+));
+
+$node_publisher->wait_for_catchup('test_part_sub');
+
+$result = $node_subscriber->safe_psql('postgres', qq(SELECT * FROM test_part_rf ORDER BY a));
+is($result,
+ qq(1|5|100
+3|6|300), 'check replicated rows with multiple row filters');
+
$node_subscriber->stop('fast');
$node_publisher->stop('fast');