创建序列时在 AS 整数处或附近出现语法错误
Syntax error at or near AS integer when creating a sequence
当我尝试使用 psql 执行时,我在下面的代码中得到 "error at or near AS integer"。
CREATE SEQUENCE public.auth_group_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
以上sql语句来自本地机器postgres version 11的备份文件,在EC2 postgres version 9.3中执行。我是 postgres 的新手,不知道因为 sql 仅由 postgres 生成,所以它应该与 psql 一起使用。提前致谢。
Postgres 9.3(即 no longer supported)不支持 AS data_type
选项。这是在版本 10 中引入的。
您可以尝试使用 9.3 安装中的 pg_dump
进行转储,但我不确定是否可行。
一些适合我的解决方法。在这种情况下,您只需从转储文件中删除 AS integer
。
sed 's/ AS integer$//g' your_dump_file.out > tmp.out
mv tmp.out your_dump_file.out
当我尝试使用 psql 执行时,我在下面的代码中得到 "error at or near AS integer"。
CREATE SEQUENCE public.auth_group_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
以上sql语句来自本地机器postgres version 11的备份文件,在EC2 postgres version 9.3中执行。我是 postgres 的新手,不知道因为 sql 仅由 postgres 生成,所以它应该与 psql 一起使用。提前致谢。
Postgres 9.3(即 no longer supported)不支持 AS data_type
选项。这是在版本 10 中引入的。
您可以尝试使用 9.3 安装中的 pg_dump
进行转储,但我不确定是否可行。
一些适合我的解决方法。在这种情况下,您只需从转储文件中删除 AS integer
。
sed 's/ AS integer$//g' your_dump_file.out > tmp.out
mv tmp.out your_dump_file.out