From 3eec089f361d42b24c8e9c2c3bfc92f9006b8e15 Mon Sep 17 00:00:00 2001
From: Corey Huinker <corey.huinker@gmail.com>
Date: Mon, 22 Jun 2026 13:48:44 -0400
Subject: [PATCH v2 4/7] postgres_fdw: additional regression reverse
 set-difference test

Add an addtional test to postgres_fdw.sql which selects the reverse
set-difference operation, allowing us to see the values in the row that
should have been set to certain values but somehow wasn't. The current
test would only show the values of the source table but not the value
found in the destination table.
---
 contrib/postgres_fdw/expected/postgres_fdw.out | 11 +++++++++++
 contrib/postgres_fdw/sql/postgres_fdw.sql      |  8 ++++++++
 2 files changed, 19 insertions(+)

diff --git a/contrib/postgres_fdw/expected/postgres_fdw.out b/contrib/postgres_fdw/expected/postgres_fdw.out
index e931fa64e0d..b46f38a04fe 100644
--- a/contrib/postgres_fdw/expected/postgres_fdw.out
+++ b/contrib/postgres_fdw/expected/postgres_fdw.out
@@ -12950,6 +12950,17 @@ WHERE oid = 'public.dtest_ftable'::regclass;
 ----------+-----------
 (0 rows)
 
+SELECT relpages, reltuples
+FROM pg_class
+WHERE oid = 'public.dtest_ftable'::regclass
+EXCEPT
+SELECT relpages, reltuples
+FROM pg_class
+WHERE oid = 'public.dtest_table'::regclass;
+ relpages | reltuples 
+----------+-----------
+(0 rows)
+
 -- test only a few stats columns common to integer types
 SELECT attname, inherited, null_frac, avg_width, n_distinct,
   most_common_vals::text as mcv, most_common_freqs,
diff --git a/contrib/postgres_fdw/sql/postgres_fdw.sql b/contrib/postgres_fdw/sql/postgres_fdw.sql
index 627177123b3..5a4f05c89e5 100644
--- a/contrib/postgres_fdw/sql/postgres_fdw.sql
+++ b/contrib/postgres_fdw/sql/postgres_fdw.sql
@@ -4601,6 +4601,14 @@ SELECT relpages, reltuples
 FROM pg_class
 WHERE oid = 'public.dtest_ftable'::regclass;
 
+SELECT relpages, reltuples
+FROM pg_class
+WHERE oid = 'public.dtest_ftable'::regclass
+EXCEPT
+SELECT relpages, reltuples
+FROM pg_class
+WHERE oid = 'public.dtest_table'::regclass;
+
 -- test only a few stats columns common to integer types
 SELECT attname, inherited, null_frac, avg_width, n_distinct,
   most_common_vals::text as mcv, most_common_freqs,
-- 
2.54.0

