Search Postgresql Archives

Re: Recovering data via raw table and field separators

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Wells wrote:
> On 12/4/07, Alvaro Herrera <alvherre@xxxxxxxxxxxxxx> wrote:
> > John Wells wrote:
> > > On 12/4/07, Alvaro Herrera <alvherre@xxxxxxxxxxxxxx> wrote:
> > > > There are no field separators.  Perhaps you could extract some useful
> > > > info with pg_filedump, which you can grab at
> > > > http://sources.redhat.com/rhdb
> > >
> > > So is it simply field width? Can one count the number of bytes based
> > > on native datatype length and determine field start/end?
> >
> > Yes.  For variable length types, there is a 4-byte length word at the
> > start of the field (unless you are using 8.3 which introduces more
> > compact representations in some cases).
> 
> Oh fun...what about record separators? I think I could live with doing
> it by name and id. Since name is the last field in the table, and id
> is the first, one could assume that it looks something like this:
> 
> 1rst record name | record separator | 2nd record id | etc, etc
> 
> If I could split on that record separator I might be able to get what I'm after.

There are no record separators either.  Records are stored following
offsets which are stored in a fixed-size array at the start of each
page, called "line pointers".  Have a look at what pg_filedump shows you
for interpreted output.

Maybe you can get away with your idea, keeping in mind that record
separators are just not there.

-- 
Alvaro Herrera                         http://www.flickr.com/photos/alvherre/
"Aprender sin pensar es inútil; pensar sin aprender, peligroso" (Confucio)

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

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux