pg_dump -t <> pg_restore -t

Started by Alexandre Arrudaalmost 20 years ago3 messagesgeneral
Jump to latest
#1Alexandre Arruda
alepaes@aldeiadigital.com.br

Hi,

If I do:

pg_dump -Fc -t TABLE database > table-custom.sql

The pg_dump returns the DDL of the table, the data and the DDL for
indexes and PK. If I use -s, only the structure is returned but it's
include all elements.

But if I do:

pg_dump -Fc database > backup-custom.file
pg_restore -Fc -t TABLE backup-custom.file > table-plain.sql

Only the DDL of table and data is returned, but not indexes, etc.

Question:

How can I restore a table with all other dependences from a custom file
database ?

PG 8.1.3

Thanks,

Alexandre

#2Richard Huxton
dev@archonet.com
In reply to: Alexandre Arruda (#1)
Re: pg_dump -t <> pg_restore -t

alexandre - aldeia digital wrote:

Hi,

If I do:

pg_dump -Fc -t TABLE database > table-custom.sql

The pg_dump returns the DDL of the table, the data and the DDL for
indexes and PK. If I use -s, only the structure is returned but it's
include all elements.

But if I do:

pg_dump -Fc database > backup-custom.file
pg_restore -Fc -t TABLE backup-custom.file > table-plain.sql

Only the DDL of table and data is returned, but not indexes, etc.

Question:

How can I restore a table with all other dependences from a custom file
database ?

The -l / -L options let you create/read back a control file listing all
the database objects. You can comment out/edit this to control pretty
much everything.

--
Richard Huxton
Archonet Ltd

#3alexandre - aldeia digital
alexandre@ad2.com.br
In reply to: Richard Huxton (#2)
Re: pg_dump -t <> pg_restore -t

Richard Huxton wrote:

alexandre - aldeia digital wrote:

Hi,

If I do:

pg_dump -Fc -t TABLE database > table-custom.sql

The pg_dump returns the DDL of the table, the data and the DDL for
indexes and PK. If I use -s, only the structure is returned but it's
include all elements.

But if I do:

pg_dump -Fc database > backup-custom.file
pg_restore -Fc -t TABLE backup-custom.file > table-plain.sql

Only the DDL of table and data is returned, but not indexes, etc.

Question:

How can I restore a table with all other dependences from a custom file
database ?

The -l / -L options let you create/read back a control file listing all
the database objects. You can comment out/edit this to control pretty
much everything.

Ok. But I have a lot of tables, and this tables have a lot of indexes.
How can I get all objects related to a table ?

Thanks,

Alexandre