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?

有帮助吗?

解决方案 2

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

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top