Question

Is there any SQL command equivalent to pg_restore? Although I can connect to a PostgreSQL database (on AWS RDS) using psycopg2 on Python, but don’t have permission to install any binary packages like pg_restore. How can I restore a dump made with pg_dump without pg_restore?

Was it helpful?

Solution 2

There is no equivalent SQL command as of now (PostgreSQL 9.3).

OTHER TIPS

From the pg_restore manpage:

pg_restore can operate in two modes. If a database name is specified, pg_restore connects to that database and restores archive contents directly into the database. Otherwise, a script containing the SQL commands necessary to rebuild the database is created and written to a file or standard output.

So, you can use pg_restore to create a series of SQL commands which you can then load into your database.

The AWS documentation implies you can load that SQL file using psql.

Note that the very same page provides detailed instructions on creating a dump using pg_dump which is already in SQL form. If you do that then you don't need to use pg_restore at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top