是否可以在不使用 pg_restore 的情况下在云 sql 中导入 postgresql 自定义格式转储文件?

Is it possible to import postgresql custom-format dump file in cloud sql without using pg_restore?

我从 c​​hembl 数据库下载了 postgresql .dmp 文件。

我想将其导入 gcp cloudsql。

当我使用控制台和 gcloud 命令 运行 时,出现以下错误:

Importing data into Cloud SQL instance...failed.
ERROR: (gcloud.sql.import.sql) [ERROR_RDBMS] exit status 1
The input is a PostgreSQL custom-format dump.
Use the pg_restore command-line client to restore this dump to a database.

我可以不使用 pg_restore 命令导入自定义格式的 dmp 文件吗?

https://cloud.google.com/sql/docs/postgres/import-export/importing

该站点的文档中有 pg_restore 的描述,但我没有理解正确。

如果是自定义格式的文件,上传到云端后是否需要pg_restoreshell?

根据CloudSQL docs

Only plain SQL format is supported by the Cloud SQL Admin API.

The custom format is allowed if the dump file is intended for use with pg_restore.

如果您由于某种原因无法使用 pg_restore,我会启动一个本地 Postgres 实例(即在您的笔记本电脑上)并使用 pg_restore 来恢复数据库。

加载到本地数据库后,您可以使用pg_dump以明文格式转储到文件,然后使用控制台或gcloud命令加载到CloudSQL。