On 1/14/26 9:53 AM, Kirill Reshke wrote:
Well, additional tests are good, but I did not get why cleanup is needed (how it worked before?). We don't create anything new in your patch, but for some reason need to drop..
Just another issue I spotted. Sorry, I should have split it into two patches for ease for review.
Andreas
From 2bc7c05ef0af17d366998029cd49dceb1c306d3e Mon Sep 17 00:00:00 2001 From: Andreas Karlsson <[email protected]> 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
From b6a9d8bdb8361b315e66e60c43203e7ee8381285 Mon Sep 17 00:00:00 2001 From: Andreas Karlsson <[email protected]> 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
