Re: Recovering data via raw table and field separators

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Recovering data via raw table and field separators
Дата
Msg-id 20071204192855.GJ18214@alvh.no-ip.org
обсуждение исходный текст
Ответ на Recovering data via raw table and field separators  ("John Wells" <jb@sourceillustrated.com>)
Список pgsql-general
John Wells wrote:
> On 12/4/07, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > John Wells wrote:
> > > On 12/4/07, Alvaro Herrera <alvherre@alvh.no-ip.org> 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)

В списке pgsql-general по дате отправления:

Предыдущее
От: "Gauthier, Dave"
Дата:
Сообщение: Re: Tuning configuration
Следующее
От: "John Wells"
Дата:
Сообщение: Re: Recovering data via raw table and field separators