I dumped a database and try to restore in the same server but in another database with another user and get some error because in the dump there are some alter table to the original user.
I did it with this commands:
Dump:
pg_dump --format=c -W -h remote.server -U originaluser originaldatabase >somefile.sql
Restore:
pg_restore -W -h remote.server -U destuser --dbname=destdatabase somefile.sql
How can i make a dump like mysqldump in mysql? So when i import the dump the index and the tables are owned by the user that is executing the import.
Thank you.
PD: I try with psql too with this line:
psql -h remote.server -W -U destuser destdatabase < somefile.sql
The error i got is that the sequence alredy exists, some table have serial8 so have a function and a sequence. How to export with different names or import in the new database without this error?
Thank you.