pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Quan Zongliang <quanzongliang@yeah.net>
To: pgsql-hackers@postgresql.org
Subject: bugfix: when the blocksize is 32k, the function page_header of pageinspect returns negative numbers.
Date: Thu, 8 Jul 2021 08:56:19 +0800
Message-ID: <8b8ec36e-61fe-14f9-005d-07bc85aa4eed@yeah.net> (raw )
If the block size is 32k, the function page_header of the pageinspect
module returns negative numbers:
postgres=# select * from page_header(get_raw_page('t1',0));
lsn | checksum | flags | lower | upper | special | pagesize |
version | prune_xid
-----------+----------+-------+-------+-------+---------+----------+---------+-----------
0/174CF58 | 0 | 0 | 28 | 32736 | -32768 | -32768 |
4 | 0
(1 row)
This patch changes the output parameters lower, upper, special and
pagesize to int32.
postgres=# select * from page_header(get_raw_page('t1',0));
lsn | checksum | flags | lower | upper | special | pagesize |
version | prune_xid
-----------+----------+-------+-------+-------+---------+----------+---------+-----------
0/19EA640 | 0 | 0 | 28 | 32736 | 32768 | 32768 |
4 | 0
(1 row)
--
Quan Zongliang
Attachments:
pageinspect.patch (text/plain, 1.5K) download
diff --git a/contrib/pageinspect/pageinspect--1.5.sql b/contrib/pageinspect/pageinspect--1.5.sql
index 1e40c3c97e..f71eff19c5 100644
--- a/contrib/pageinspect/pageinspect--1.5.sql
+++ b/contrib/pageinspect/pageinspect--1.5.sql
@@ -23,10 +23,10 @@ CREATE FUNCTION page_header(IN page bytea,
OUT lsn pg_lsn,
OUT checksum smallint,
OUT flags smallint,
- OUT lower smallint,
- OUT upper smallint,
- OUT special smallint,
- OUT pagesize smallint,
+ OUT lower int,
+ OUT upper int,
+ OUT special int,
+ OUT pagesize int,
OUT version smallint,
OUT prune_xid xid)
AS 'MODULE_PATHNAME', 'page_header'
diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c
index 7272b21016..af04c1a688 100644
--- a/contrib/pageinspect/rawpage.c
+++ b/contrib/pageinspect/rawpage.c
@@ -316,10 +316,10 @@ page_header(PG_FUNCTION_ARGS)
values[0] = LSNGetDatum(lsn);
values[1] = UInt16GetDatum(page->pd_checksum);
values[2] = UInt16GetDatum(page->pd_flags);
- values[3] = UInt16GetDatum(page->pd_lower);
- values[4] = UInt16GetDatum(page->pd_upper);
- values[5] = UInt16GetDatum(page->pd_special);
- values[6] = UInt16GetDatum(PageGetPageSize(page));
+ values[3] = Int32GetDatum(page->pd_lower);
+ values[4] = Int32GetDatum(page->pd_upper);
+ values[5] = Int32GetDatum(page->pd_special);
+ values[6] = Int32GetDatum(PageGetPageSize(page));
values[7] = UInt16GetDatum(PageGetPageLayoutVersion(page));
values[8] = TransactionIdGetDatum(page->pd_prune_xid);
view thread (17+ messages) latest in thread
Message-ID: <8b8ec36e-61fe-14f9-005d-07bc85aa4eed@yeah.net>
Permalink: ../8b8ec36e-61fe-14f9-005d-07bc85aa4eed@yeah.net/
Also on: postgresql.org/message-id/8b8ec36e-61fe-14f9-005d-07bc85aa4eed@yeah.net
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: quanzongliang@yeah.net
Subject: Re: bugfix: when the blocksize is 32k, the function page_header of pageinspect returns negative numbers.
In-Reply-To: <8b8ec36e-61fe-14f9-005d-07bc85aa4eed@yeah.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox