2

I have a database with several tables and I want to add the data and structure of a selection of them to a different database containing already different tables.

I have created the dump file in the following way:

"C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe" -U postgres -w DBName -t table1 -t Table2 -t Table3 > "E:\Dump.sql" 

This works fine and I have E:\Dump.sql with the dump of the three tables in it. I have tried to make a restore with the following code:

"C:\Program Files\PostgreSQL\9.6\bin\pg_dump.exe" -C -U User -t table1 -t Table2 -t Table4 destdb < Dump.sql 

but I get the error

no matching tables were found

.

Where am I doing wrong?

1 Answer 1

1

https://www.postgresql.org/docs/current/static/backup-dump.html

pg_dump is meant for **taking* backups, next section of manual is for restoring a backup:

Text files created by pg_dump are intended to be read in by the psql program. The general command form to restore a dump is

psql dbname < infile

Also you mention three tables, two of which are mixed case - in order for it to work, you have to double quote it I believe. But anyway - restoring for you file would be:

psql YOURDBNAME -f E:\Dump.sql 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.