Retrieving page contents from SQL, Postgresql?
pageinspect module

Using PostgreSQL, there is an extension that does all of this. Your question is vague so I won't even try to address the particulars here, nor is it reasonable to enumerate everything this extension does, perhaps it's enough to say that it has 17 functions and as far as I know includes all of the mechanisms available to end users to introspect pages (not saying it does everything you want).

You may want to read Database Page Layout