Re: Heap page diagnostic/test functions (v2) - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Re: Heap page diagnostic/test functions (v2)
Date
Msg-id 4624B13A.2090801@enterprisedb.com
Whole thread Raw
In response to Heap page diagnostic/test functions (v2)  ("Simon Riggs" <simon@2ndquadrant.com>)
List pgsql-patches
Simon Riggs wrote:
> New functions to examine the contents of heap pages, as discussed
> recently on -hackers. These are fully integrated into backend.
> ...
> I'll maintain this with immediate fixes/additions as we go up to 8.3 and
> beyond, to assist review process of various patches that alter page
> contents.

Excellent. I agree with the other comments that these should all be in
contrib.

The functions need to be very careful to handle invalid data gracefully.
For example, this will return bogus data or crash if the offset in the
line pointer is corrupt, past the end of page for example:

+    tuphdr = (HeapTupleHeader) PageGetItem((Page) inter_call_data->page, id);

It's particularly important if the page-examining functions are not
superuser-only, to avoid vulnerabilities. Even if they are, the
functions are for diagnostic purposes and diagnosis is often done on
something that's corrupt.

Dare I propose deprecating the all the system columns except for ctid in
favor of these functions? I guess there's no immediate reason to remove
them, but these functions feel like a much better design than tightly
integrated system columns.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-patches by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: [HACKERS] Re: IDENTITY/GENERATED v36 Re: Final version of IDENTITY/GENERATED patch
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] Re: IDENTITY/GENERATED v36 Re: Final version of IDENTITY/GENERATED patch