Re: Heap page diagnostic/test functions (v2)

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Heap page diagnostic/test functions (v2)
Date: 2007-04-17 11:36:26
Message-ID: 4624B13A.2090801@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2007-04-17 13:57:28 Re: [HACKERS] Re: IDENTITY/GENERATED v36 Re: Final version of IDENTITY/GENERATED patch
Previous Message Zoltan Boszormenyi 2007-04-17 10:01:19 Re: [HACKERS] Re: IDENTITY/GENERATED v36 Re: Final version of IDENTITY/GENERATED patch