Re: pg_dump / pg_restore - TOC.dat file

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Felipe Santos <felipepts(at)gmail(dot)com>
Cc: Clécio Anderson <clecioanderson(at)gmail(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: pg_dump / pg_restore - TOC.dat file
Date: 2016-01-26 17:37:17
Message-ID: 20160126173717.GA565213@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Felipe Santos wrote:

> 11471; 1262 36497111 DATABASE - mydb postgres
>
> 11471 - ?
> 1262 - ?
> 36497111 - Object ID
> DATABASE - Object Type
> mydb - Object Name
> postgres - Object Owner

The code that writes this is PrintTOCSummary() in
src/bin/pg_dump/pg_backup_archiver.c -- see that if you want more
details. (Each object here is a TocEntry struct, which is defined in
pg_backup_archiver.h, search for _tocEntry. Useful comments there.)

11471 is the internal ID of the object in the dump. Note that ; is a
comment delimiter for the TOC format, so if you just write the 11471 in
a separate line, the correct object is specified. The rest of the
entries after the ; are just commentary so that the DBA can understand
what the entry is for.

1262 is the OID of the pg_database catalog, so this identifies the entry
as a database. This is redundant with having DATABASE in the object
type. Similarly, 36497111 is the pg_database.oid column which is
redundant with having mydb as the database name.

The hyphen - is for the schema, if the object belongs into a schema.
A database obviously doesn't have one, hence the - in this particular
sample.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Artem Tomyuk 2016-01-26 17:51:26 custom log. variable %h reports [unknown]
Previous Message Felipe Santos 2016-01-26 10:02:11 Re: pg_dump / pg_restore - TOC.dat file