diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out
index 092629944526a50b113d843473f378b82f398e4a..823d9e142db0b9eb1999c48762678fe5f2353a38 100644
--- a/src/test/regress/expected/sanity_check.out
+++ b/src/test/regress/expected/sanity_check.out
@@ -1,11 +1,12 @@
 VACUUM;
 --
 -- sanity check, if we don't have indices the test will take years to
--- complete.
+-- complete.  But skip TOAST relations since they will have varying
+-- names depending on the current OID counter.
 --
 SELECT relname, relhasindex
    FROM pg_class
-   WHERE relhasindex
+   WHERE relhasindex AND relkind != 't'
    ORDER BY relname;
        relname       | relhasindex 
 ---------------------+-------------
diff --git a/src/test/regress/expected/type_sanity.out b/src/test/regress/expected/type_sanity.out
index 19710312dff2898f1e30b1b814232f7c7e64cdbd..38eaf0b21dad6d544f6e7ade125c559944996a51 100644
--- a/src/test/regress/expected/type_sanity.out
+++ b/src/test/regress/expected/type_sanity.out
@@ -111,8 +111,7 @@ WHERE p1.typsend = p2.oid AND p1.typtype = 'b' AND
 -- Look for illegal values in pg_class fields
 SELECT p1.oid, p1.relname
 FROM pg_class as p1
-WHERE (p1.relkind != 'r' AND p1.relkind != 'i' AND
-       p1.relkind != 's' AND p1.relkind != 'S');
+WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 't');
  oid | relname 
 -----+---------
 (0 rows)
diff --git a/src/test/regress/sql/sanity_check.sql b/src/test/regress/sql/sanity_check.sql
index e7c337761bf106e5c03c26ce67b428700cc9681c..696a4f425d194c868aad1e8b53f4d3c4cd47e518 100644
--- a/src/test/regress/sql/sanity_check.sql
+++ b/src/test/regress/sql/sanity_check.sql
@@ -2,10 +2,11 @@
 VACUUM;
 --
 -- sanity check, if we don't have indices the test will take years to
--- complete.
+-- complete.  But skip TOAST relations since they will have varying
+-- names depending on the current OID counter.
 --
 SELECT relname, relhasindex
    FROM pg_class
-   WHERE relhasindex
+   WHERE relhasindex AND relkind != 't'
    ORDER BY relname;
 
diff --git a/src/test/regress/sql/type_sanity.sql b/src/test/regress/sql/type_sanity.sql
index 312fd2857af110b2e92b5e9ac863c293ec8998db..106a86b87c8c9df9ccbe844d39bc1c52fa74ee72 100644
--- a/src/test/regress/sql/type_sanity.sql
+++ b/src/test/regress/sql/type_sanity.sql
@@ -99,8 +99,7 @@ WHERE p1.typsend = p2.oid AND p1.typtype = 'b' AND
 
 SELECT p1.oid, p1.relname
 FROM pg_class as p1
-WHERE (p1.relkind != 'r' AND p1.relkind != 'i' AND
-       p1.relkind != 's' AND p1.relkind != 'S');
+WHERE p1.relkind NOT IN ('r', 'i', 's', 'S', 't');
 
 -- Indexes should have an access method, others not.