The input is a PostgreSQL custom-format dump. Use the pg_restore command-line client to restore this dump to a database.

12,652

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.

Share:
12,652
PPShein
Author by

PPShein

Updated on July 26, 2022

Comments

  • PPShein
    PPShein almost 2 years

    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?