Home pg_restore clean table psql
Reply: 0

pg_restore clean table psql

user908 Published in May 24, 2018, 3:54 pm

I am trying to restore a table I dumped to its current location. The table was dumped using:

pg_dump -t table db > table.sql -U username

Trying to restore, I'm using:

pg_restore -c --dbname=db --table=table table.sql

I am using -c since the table currently exists and has data, however it returns:

pg_restore: [archiver] input file appears to be a text format dump. Please use psql.

I've also tried:

-bash-4.2$ psql -U username -d db -1 -f table.sql

But since the data is there already and there's no --clean option for this psql command (I believe), it returns:

psql:table.sql:32: ERROR:  relation "table" already exists

Is there a way to use pg_restore correctly or use psql with a --clean option?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.633169 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO