postgresql - 输入是 PostgreSQL 自定义格式转储。使用 pg_restore 命令行客户端将此转储恢复到数据库。

标签 postgresql google-app-engine gcloud

当我尝试将 postgres 转储文件导入 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.

请告诉我如何将 postgres 转储文件(托管在 Google Cloud Storage 上)导入 Google Cloud SQL?

最佳答案

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.

从错误中你看到我假设你使用了自定义格式,因此你准备的导入 sql 将不起作用(至少通过文档)

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.

关于postgresql - 输入是 PostgreSQL 自定义格式转储。使用 pg_restore 命令行客户端将此转储恢复到数据库。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48018342/

相关文章:

postgresql - Wildfly Postgres JDBC 模块问题

sql - 每月累计总计和 Postgresql

postgresql - PostGIS 安装 "could not open extension control file"

python - 在 Google App Engine 中使用子过滤器/查询

javascript - 使用 NodeJs sdk 在谷歌云存储中生成 getServingUrl()

sql - 最后一个预期列 CSV 之后的 Postgres 额外数据

node.js - Google App Engine 灵活获取对包动态创建的文件夹的访问权限?

python - 有没有办法让 Google App Engine 打印出所有遇到的 Python 错误?我收到服务器错误,但不知道为什么

google-cloud-platform - 云容器集群创建 `compute.networks.get`权限错误

google-compute-engine - 如何检索Google SDK密码