Re: [HACKERS] PATCH: pageinspect / add page_checksum andbt_page_items(bytea) - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] PATCH: pageinspect / add page_checksum andbt_page_items(bytea)
Date
Msg-id dd28c9bc-c225-eb2c-e844-290e2bfbc178@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] PATCH: pageinspect / add page_checksum andbt_page_items(bytea)  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: [HACKERS] PATCH: pageinspect / add page_checksum andbt_page_items(bytea)  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
On 3/3/17 09:03, Tomas Vondra wrote:
> Attached is v2, fixing both issues.

I wonder if

+   bytea      *raw_page = PG_GETARG_BYTEA_P(0);

+       uargs->page = VARDATA(raw_page);

is expected to work reliably, without copying the argument to a
different memory context.

I think it would be better not to maintain so much duplicate code
between bt_page_items(text, int) and bt_page_items(bytea).  How about
just redefining bt_page_items(text, int) as an SQL-language function
calling bt_page_items(get_raw_page($1, $2))?

For page_checksum(), the checksums are internally unsigned, so maybe
return type int on the SQL level, so that there is no confusion about
the sign?

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: [HACKERS] WARNING: relcache reference leak: relation "p1" not closed
Next
From: Stephen Frost
Date:
Subject: Re: [HACKERS] dump a comment of a TSDictionary