我的问题是关于使用SERIAL PRIMARY KEY运行CREATE TABLE,但始终会出错。即使我根据错误更正了代码。错误仍然存在。任何帮助表示赞赏。
DROP TABLE IF EXISTS nm_land_grants;
CREATE TABLE nm_land_grants (
ID SERIAL, land_grant INT,
area REAL, perimeter REAL,
grant_name VARCHAR(255),
land_grant INT, land_gra_1 INT,
survey_app DATE, grant_conf DATE
CONSTRAINT pk_nm_land_grants
PRIMARY KEY (ID)
);
我得到的错误如下:
Done.
(psycopg2.ProgrammingError) syntax error at or near "("
LINE 6: PRIMARY KEY (ID)
^
[SQL: 'CREATE TABLE nm_land_grants (\n ID SERIAL, land_grant INT, area
REAL, perimeter REAL,\n grant_name VARCHAR(255), land_grant INT,
land_gra_1 INT,\n survey_app DATE, grant_conf DATE\n CONSTRAINT
pk_nm_land_grants\n PRIMARY KEY (ID)\n);']