Restore of only one table - Postgresql

1

How can I restore only one table from one bank to another?

I created the table backup from the following command in the CMD:

pg_dump -f C:\Backup\Backup_table.backup -t public.lotesretornosuprimento -d BancoDados

But I'm not finding how I can restore this table only

    
asked by anonymous 19.02.2018 / 19:43

1 answer

1

Since you only dump a table, pg_restore would only have one object to restore. Anyway there is the -t parameter to define the tables that will be restored.

pg_restore -t public.lotesretornosuprimento -d BancoDados C:\Backup\Backup_table.backup

If you want to restore only the data, without sending the commands to create the schema, use the parameter -a .

If you need to re-create the objects before restoring use the -c parameter.

More details about pg_restore can be found in the postgres documentation: link

    
20.02.2018 / 12:28