From 2bc7c05ef0af17d366998029cd49dceb1c306d3e Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <andreas@proxel.se>
Date: Wed, 14 Jan 2026 10:13:07 +0100
Subject: [PATCH v3 1/2] Drop all object created by amchecks heap tests

---
 contrib/amcheck/expected/check_heap.out | 6 ++++++
 contrib/amcheck/sql/check_heap.sql      | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/contrib/amcheck/expected/check_heap.out b/contrib/amcheck/expected/check_heap.out
index 979e5e84e72..43a4379d1f6 100644
--- a/contrib/amcheck/expected/check_heap.out
+++ b/contrib/amcheck/expected/check_heap.out
@@ -232,6 +232,12 @@ SELECT * FROM verify_heapam('test_foreign_table',
 ERROR:  cannot check relation "test_foreign_table"
 DETAIL:  This operation is not supported for foreign tables.
 -- cleanup
+DROP FOREIGN DATA WRAPPER dummy CASCADE;
+NOTICE:  drop cascades to 2 other objects
+DETAIL:  drop cascades to server dummy_server
+drop cascades to foreign table test_foreign_table
+DROP VIEW test_view;
+DROP SEQUENCE test_sequence;
 DROP TABLE heaptest;
 DROP TABLESPACE regress_test_stats_tblspc;
 DROP TABLE test_partition;
diff --git a/contrib/amcheck/sql/check_heap.sql b/contrib/amcheck/sql/check_heap.sql
index 1745bae634e..53e1ef3076e 100644
--- a/contrib/amcheck/sql/check_heap.sql
+++ b/contrib/amcheck/sql/check_heap.sql
@@ -139,6 +139,9 @@ SELECT * FROM verify_heapam('test_foreign_table',
 							endblock := NULL);
 
 -- cleanup
+DROP FOREIGN DATA WRAPPER dummy CASCADE;
+DROP VIEW test_view;
+DROP SEQUENCE test_sequence;
 DROP TABLE heaptest;
 DROP TABLESPACE regress_test_stats_tblspc;
 DROP TABLE test_partition;
-- 
2.47.3

