From da9e30360b14156b598f61c2dd7a59fa49ed1340 Mon Sep 17 00:00:00 2001 From: Andrey Borodin Date: Tue, 16 Dec 2025 16:55:07 +0500 Subject: [PATCH v20251216 3/3] =?UTF-8?q?Address=20review=20comments=20by?= =?UTF-8?q?=20Mi=C5=82osz=20and=20Sergey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/amcheck/amcheck--1.5--1.6.sql | 2 +- contrib/amcheck/expected/check_gist.out | 2 ++ contrib/amcheck/meson.build | 2 +- contrib/amcheck/sql/check_gist.sql | 5 ++++- contrib/amcheck/verify_gist.c | 6 +++--- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/contrib/amcheck/amcheck--1.5--1.6.sql b/contrib/amcheck/amcheck--1.5--1.6.sql index a6a1debff12..e2d4ca60d5e 100644 --- a/contrib/amcheck/amcheck--1.5--1.6.sql +++ b/contrib/amcheck/amcheck--1.5--1.6.sql @@ -11,4 +11,4 @@ RETURNS VOID AS 'MODULE_PATHNAME', 'gist_index_check' LANGUAGE C STRICT; -REVOKE ALL ON FUNCTION gist_index_check(regclass,boolean) FROM PUBLIC; +REVOKE ALL ON FUNCTION gist_index_check(regclass, boolean) FROM PUBLIC; diff --git a/contrib/amcheck/expected/check_gist.out b/contrib/amcheck/expected/check_gist.out index cbc3e27e679..e229f38aa48 100644 --- a/contrib/amcheck/expected/check_gist.out +++ b/contrib/amcheck/expected/check_gist.out @@ -143,3 +143,5 @@ SELECT gist_index_check('toasty', true); (1 row) +-- cleanup +DROP TABLE toast_bug; diff --git a/contrib/amcheck/meson.build b/contrib/amcheck/meson.build index 13b36b495ed..536af0cccd4 100644 --- a/contrib/amcheck/meson.build +++ b/contrib/amcheck/meson.build @@ -2,10 +2,10 @@ amcheck_sources = files( 'verify_common.c', + 'verify_gist.c', 'verify_gin.c', 'verify_heapam.c', 'verify_nbtree.c', - 'verify_gist.c', ) if host_system == 'windows' diff --git a/contrib/amcheck/sql/check_gist.sql b/contrib/amcheck/sql/check_gist.sql index 37966423b8b..bc5737a7710 100644 --- a/contrib/amcheck/sql/check_gist.sql +++ b/contrib/amcheck/sql/check_gist.sql @@ -59,4 +59,7 @@ WHERE attrelid = 'toast_bug'::regclass AND attname = 'buggy'; -- Insert compressible heap tuple (comfortably exceeds TOAST_TUPLE_THRESHOLD): INSERT INTO toast_bug SELECT point(0,0), repeat('a', 2200); -- Should not get false positive report of corruption: -SELECT gist_index_check('toasty', true); \ No newline at end of file +SELECT gist_index_check('toasty', true); + +-- cleanup +DROP TABLE toast_bug; \ No newline at end of file diff --git a/contrib/amcheck/verify_gist.c b/contrib/amcheck/verify_gist.c index c15cd6ab556..3c4abfda538 100644 --- a/contrib/amcheck/verify_gist.c +++ b/contrib/amcheck/verify_gist.c @@ -87,10 +87,10 @@ typedef struct GistCheckState PG_FUNCTION_INFO_V1(gist_index_check); -static void giststate_init_heapallindexed(Relation rel, GistCheckState * result); +static void giststate_init_heapallindexed(Relation rel, GistCheckState *result); static void gist_check_parent_keys_consistency(Relation rel, Relation heaprel, void *callback_state, bool readonly); -static void gist_check_page(GistCheckState * check_state, GistScanItem * stack, +static void gist_check_page(GistCheckState *check_state, GistScanItem *stack, Page page, bool heapallindexed, BufferAccessStrategy strategy); static void check_index_page(Relation rel, Buffer buffer, BlockNumber blockNo); @@ -366,7 +366,7 @@ gist_check_parent_keys_consistency(Relation rel, Relation heaprel, } static void -gist_check_page(GistCheckState * check_state, GistScanItem * stack, +gist_check_page(GistCheckState *check_state, GistScanItem *stack, Page page, bool heapallindexed, BufferAccessStrategy strategy) { OffsetNumber maxoff = PageGetMaxOffsetNumber(page); -- 2.51.2