Re: dat names generated by pg_dump - Mailing list pgsql-general

From Tom Lane
Subject Re: dat names generated by pg_dump
Date
Msg-id 13488.1535941572@sss.pgh.pa.us
Whole thread Raw
In response to dat names generated by pg_dump  (Ron <ronljohnsonjr@gmail.com>)
Responses Re: dat names generated by pg_dump  (Ron <ronljohnsonjr@gmail.com>)
List pgsql-general
Ron <ronljohnsonjr@gmail.com> writes:
> I can associate these dat names with their source tables through a bunch of
> bash and vim manual operations, but I was wondering if there's any automated
> method (maybe some SQL query of some catalog table; pg_class didn't seem to
> have the relevant data) of making the association.

Those numbers are the "dump object IDs" generated by pg_dump.  They don't
have any significance on the server side, and typically would vary from
one pg_dump run to another.  You have to look at the dump TOC (table of
contents) to figure out what corresponds to what.  For example,

$ pg_dump -Fd -f dumpd regression
$ ls -1 dumpd
6143.dat.gz
6144.dat.gz
6145.dat.gz
...
blob_3001.dat.gz
blobs.toc
toc.dat
$ pg_restore -l dumpd
;
; Archive created at 2018-09-02 22:14:48 EDT
...
6573; 2613 119655 BLOB - 119655 postgres
6574; 2613 3001 BLOB - 3001 postgres
6603; 0 0 COMMENT - LARGE OBJECT 3001 postgres
6247; 0 100933 TABLE DATA public a postgres
6212; 0 89417 TABLE DATA public a_star postgres
6180; 0 88516 TABLE DATA public abstime_tbl postgres
6218; 0 89444 TABLE DATA public aggtest postgres
6446; 0 121383 TABLE DATA public alter_table_under_transition_tables postgres
...

The numbers before the semicolons are the dump IDs.  In particular

$ pg_restore -l dumpd | grep 6143
6143; 0 88018 TABLE DATA public int4_tbl postgres

so 6143.dat.gz contains the data for table public.int4_tbl.  There
will only be separate files in the dump directory for TABLE DATA and
BLOB dump objects ... other stuff is just embedded in the toc.dat file.

            regards, tom lane


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: dat names generated by pg_dump
Next
From: Ron
Date:
Subject: Re: dat names generated by pg_dump