BUG #16285: bt_metap fails with value is out of range for type integer

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: vyegorov(at)gmail(dot)com
Subject: BUG #16285: bt_metap fails with value is out of range for type integer
Date: 2020-03-02 22:39:14
Message-ID: 16285-df8fc1000ab3d5fc@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 16285
Logged by: Victor Yegorov
Email address: vyegorov(at)gmail(dot)com
PostgreSQL version: 12.2
Operating system: Ubuntu 18.04.3 LTS
Description:

I have an index, that is giving issues pageinspect-ing it:

SELECT * FROM bt_metap('index')\gx
ERROR: value "2180413846" is out of range for type integer

At the same time:

SELECT * FROM pgstatindex('index')\gx
-[ RECORD 1 ]------+----------
version | 3
tree_level | 2
index_size | 131571712
root_block_no | 290
internal_pages | 56
leaf_pages | 16003
empty_pages | 0
deleted_pages | 1
avg_leaf_density | 50.06
leaf_fragmentation | 66.08

Looking at the sources of both extensions, I can see, that pgstatindex() is
using psprintf(INT64_FORMAT) for page counters and psprintf("%u") for root
page, while bt_metap() is using only psprintf("%d");

I assume psprintf("%u") should be used at least for metad->btm_root and
metad->btm_fastroot in the bt_metap(PG_FUNCTION_ARGS) function.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2020-03-02 23:03:25 Re: BUG #16285: bt_metap fails with value is out of range for type integer
Previous Message Tomas Vondra 2020-03-02 21:31:21 Re: BUG #16283: crash on create index segmentation fault