简体   繁体   English

Django postgresql 管理员导入 sql 文件语法错误

[英]Django postgresql adminer import sql file syntax error

Firstly I exported the database in sql file and without changing anything, I tried to import same sql file to empty postgresql database using adminer.首先,我在 sql 文件中导出了数据库,在不做任何更改的情况下,我尝试使用管理员将相同的 sql 文件导入到空的 postgresql 数据库中。 But I get some errors and don't know what is the problem但是我得到了一些错误,不知道是什么问题

VERSION: postgres:14.6版本: postgres:14.6

ERROR IS LIKE THAT:错误是这样的:

CREATE TABLE "public"."auth_group" (
    "id" integer DEFAULT GENERATED BY DEFAULT AS IDENTITY NOT NULL,
    "name" character varying(150) NOT NULL,
    CONSTRAINT "auth_group_name_key" UNIQUE ("name"),
    CONSTRAINT "auth_group_pkey" PRIMARY KEY ("id")
) WITH (oids = false)
Error in query (7): ERROR: syntax error at or near "BY"
LINE 2: "id" integer DEFAULT GENERATED BY DEFAULT AS IDENTITY NO...

Any ideas?有任何想法吗?

As documented in the manual the correct syntax is:如手册中所述,正确的语法是:

id" integer GENERATED BY DEFAULT AS IDENTITY NOT NULL,

The DEFAULT after integer is wrong. integer之后的DEFAULT是错误的。

Online example在线示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM