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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to