From 662cda6c10cc2a0c70e6bd6a9ed4712222c87993 Mon Sep 17 00:00:00 2001
From: Andrey Borodin <amborodin@acm.org>
Date: Wed, 28 Mar 2018 15:03:20 +0500
Subject: [PATCH 3/3] Tests for subsciptions with sovering indexes

---
 src/test/subscription/t/001_rep_changes.pl | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl
index e0104cd8d0..0969a7d87d 100644
--- a/src/test/subscription/t/001_rep_changes.pl
+++ b/src/test/subscription/t/001_rep_changes.pl
@@ -27,6 +27,10 @@ $node_publisher->safe_psql('postgres',
 	"INSERT INTO tab_full2 VALUES ('a'), ('b'), ('b')");
 $node_publisher->safe_psql('postgres',
 	"CREATE TABLE tab_rep (a int primary key)");
+$node_publisher->safe_psql('postgres',
+	"CREATE TABLE tab_cov (a int, b text)");
+$node_publisher->safe_psql('postgres',
+	"ALTER TABLE tab_cov ADD PRIMARY KEY(a) INCLUDE (b)");
 $node_publisher->safe_psql('postgres',
 	"CREATE TABLE tab_mixed (a int primary key, b text)");
 $node_publisher->safe_psql('postgres',
@@ -39,6 +43,10 @@ $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full (a int)");
 $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)");
 $node_subscriber->safe_psql('postgres',
 	"CREATE TABLE tab_rep (a int primary key)");
+$node_subscriber->safe_psql('postgres',
+	"CREATE TABLE tab_cov (a int, b text)");
+$node_subscriber->safe_psql('postgres',
+	"ALTER TABLE tab_cov ADD PRIMARY KEY(a) INCLUDE (b)");
 
 # different column count and order than on publisher
 $node_subscriber->safe_psql('postgres',
@@ -50,7 +58,7 @@ $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub");
 $node_publisher->safe_psql('postgres',
 	"CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)");
 $node_publisher->safe_psql('postgres',
-"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed"
+"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_cov, tab_full, tab_full2, tab_mixed"
 );
 $node_publisher->safe_psql('postgres',
 	"ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins");
@@ -86,6 +94,11 @@ $node_publisher->safe_psql('postgres',
 $node_publisher->safe_psql('postgres', "DELETE FROM tab_rep WHERE a > 20");
 $node_publisher->safe_psql('postgres', "UPDATE tab_rep SET a = -a");
 
+$node_publisher->safe_psql('postgres',
+	"INSERT INTO tab_cov SELECT generate_series(1,50)");
+$node_publisher->safe_psql('postgres', "DELETE FROM tab_cov WHERE a > 20");
+$node_publisher->safe_psql('postgres', "UPDATE tab_cov SET a = -a");
+
 $node_publisher->safe_psql('postgres',
 	"INSERT INTO tab_mixed VALUES (2, 'bar')");
 
@@ -99,6 +112,10 @@ $result = $node_subscriber->safe_psql('postgres',
 	"SELECT count(*), min(a), max(a) FROM tab_rep");
 is($result, qq(20|-20|-1), 'check replicated changes on subscriber');
 
+$result = $node_subscriber->safe_psql('postgres',
+	"SELECT count(*), min(a), max(a) FROM tab_cov");
+is($result, qq(20|-20|-1), 'check replicated changes on subscriber');
+
 $result =
   $node_subscriber->safe_psql('postgres', "SELECT c, b, a FROM tab_mixed");
 is( $result, qq(|foo|1
-- 
2.14.3 (Apple Git-98)

