【发布时间】:2019-03-29 01:20:19
【问题描述】:
问题:
将架构从 AWS Postgres 导入 Gcloud postgres 时出现以下错误。
错误:
Import failed:
SET
SET
SET
SET
SET set_config
------------
(1 row)
SET
SET
SET
CREATE SCHEMA
SET
SET
CREATE TABLE
ERROR: syntax error at or near "AS" LINE 2: AS integer ^
Import error: exit status 3
我在从 AWS postgres 导出数据时使用了--no-acl --no-owner --format=plain
pg_dump -Fc -n <schema_name> -h hostname -U user -d database --no-acl --no-owner --format=plain -f data.dump
我能够在使用相同方法导出的 gcloud sql 中导入某些架构,但对于其他一些类似架构会出错。表具有地理空间信息,并且 postgis 已安装在目标数据库中。
在这里寻求一些快速帮助。
【问题讨论】:
-
CREATE TABLE sample.geofences (id integer NOT NULL, geofence public.geometry(Polygon,4326),venue_id text);
-
CREATE TABLE 下的哪一行,包含单词 AS?
-
分享一下这个解决方案怎么样?
-
我的解决方案:基本上,我有一个来自 postgres 10.0 的数据转储文件,其中的表具有 PK 的“序列”。显然,Gcloud postgres 9.6 没有正确读取序列以及其他表数据转储到文件中的方式。那就是它给出错误“AS整数”的地方。另外,最后我确实在我之前找不到的转储文件中找到了这个快递。因此我需要过滤掉这个位。 CREATE SEQUENCE sample.geofences_id_seq AS integer
标签: sql postgresql gcloud