I've encountered following error message when I'm trying to import postgres dump file to Google Cloud SQL.
The input is a PostgreSQL custom-format dump. Use the pg_restore command-line client to restore this dump to a database. This may take a few minutes. While this operation is running, you may continue to view information about the instance.
Please let me know how to import postgres dump file (which is hosted on Google Cloud Storage) to Google Cloud SQL?
To restore a PostgreSQL database, you can use the psql or pg_restore utilities. psql is used to restore text files created by pg_dump whereas pg_restore is used to restore a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats (custom, tar, or directory).
https://cloud.google.com/sql/docs/postgres/import-export/creating-sqldump-csv
Important: you must ensure that your SQL dump file is created with the following flags:
- --no-owner Ownership change commands must not be included in the SQL dump file.
- --format=plain Only plain SQL format is currently supported by Cloud SQL.
and from error you see I assume you used custom format, thus the import sql you prepared won't work (at least by documentation)
https://www.postgresql.org/docs/current/static/app-pgdump.html
--format=format Selects the format of the output. format can be one of the following:
p plain Output a plain-text SQL script file (the default).
c custom Output a custom-format archive suitable for input into pg_restore. Together with the directory output format, this is the most flexible output format in that it allows manual selection and reordering of archived items during restore. This format is also compressed by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With