From b6a9d8bdb8361b315e66e60c43203e7ee8381285 Mon Sep 17 00:00:00 2001
From: Andreas Karlsson <andreas@proxel.se>
Date: Wed, 14 Jan 2026 10:13:30 +0100
Subject: [PATCH v3 2/2] Improve amcheck heap tests for sequences

The test for sequences claims that it will reject sequences but it
actually does not do so. While fixing this we also make the test more
like the tests for heap tables
---
 contrib/amcheck/expected/check_heap.out | 22 ++++++++++++++++++----
 contrib/amcheck/sql/check_heap.sql      | 10 ++++++----
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/contrib/amcheck/expected/check_heap.out b/contrib/amcheck/expected/check_heap.out
index 43a4379d1f6..bc0c6966b5a 100644
--- a/contrib/amcheck/expected/check_heap.out
+++ b/contrib/amcheck/expected/check_heap.out
@@ -213,11 +213,25 @@ SELECT * FROM verify_heapam('test_view',
 							endblock := NULL);
 ERROR:  cannot check relation "test_view"
 DETAIL:  This operation is not supported for views.
--- Check that sequences are rejected
+-- Check that valid options are not rejected nor corruption reported
+-- for a sequence
 CREATE SEQUENCE test_sequence;
-SELECT * FROM verify_heapam('test_sequence',
-							startblock := NULL,
-							endblock := NULL);
+SELECT * FROM verify_heapam(relation := 'test_sequence', skip := 'none');
+ blkno | offnum | attnum | msg 
+-------+--------+--------+-----
+(0 rows)
+
+SELECT * FROM verify_heapam(relation := 'test_sequence', skip := 'all-frozen');
+ blkno | offnum | attnum | msg 
+-------+--------+--------+-----
+(0 rows)
+
+SELECT * FROM verify_heapam(relation := 'test_sequence', skip := 'all-visible');
+ blkno | offnum | attnum | msg 
+-------+--------+--------+-----
+(0 rows)
+
+SELECT * FROM verify_heapam(relation := 'test_sequence', startblock := 0, endblock := 0);
  blkno | offnum | attnum | msg 
 -------+--------+--------+-----
 (0 rows)
diff --git a/contrib/amcheck/sql/check_heap.sql b/contrib/amcheck/sql/check_heap.sql
index 53e1ef3076e..7fbdc5abc76 100644
--- a/contrib/amcheck/sql/check_heap.sql
+++ b/contrib/amcheck/sql/check_heap.sql
@@ -124,11 +124,13 @@ SELECT * FROM verify_heapam('test_view',
 							startblock := NULL,
 							endblock := NULL);
 
--- Check that sequences are rejected
+-- Check that valid options are not rejected nor corruption reported
+-- for a sequence
 CREATE SEQUENCE test_sequence;
-SELECT * FROM verify_heapam('test_sequence',
-							startblock := NULL,
-							endblock := NULL);
+SELECT * FROM verify_heapam(relation := 'test_sequence', skip := 'none');
+SELECT * FROM verify_heapam(relation := 'test_sequence', skip := 'all-frozen');
+SELECT * FROM verify_heapam(relation := 'test_sequence', skip := 'all-visible');
+SELECT * FROM verify_heapam(relation := 'test_sequence', startblock := 0, endblock := 0);
 
 -- Check that foreign tables are rejected
 CREATE FOREIGN DATA WRAPPER dummy;
-- 
2.47.3

