您好我在创建简单表时阻止请帮帮我 使用ubuntu 11.04 - PostgreSQL 8.4.8 用phppgadmin我得到这段代码:
CREATE TABLE users
(
id SERIAL,
username CHARACTER VARYING(255),
PASSWORD CHARACTER VARYING(255),
etat INTEGER(1),
avatar CHARACTER VARYING(255),
description text,
email CHARACTER VARYING(255),
website CHARACTER VARYING(255),
country CHARACTER VARYING(255),
location CHARACTER VARYING(255),
nb_upload INTEGER,
sexe CHARACTER VARYING(25),
group_id INTEGER,
created DATE,
modified DATE,
enable_mail INTEGER(1),
enable_location INTEGER(1),
facebook_id BIGINT,
PRIMARY KEY (id)
)
但每次执行时都会返回此错误:
错误:语法错误在或附近“(” 第1行:...“密码”字符变化(255),“etat”整数(1),“avat ...
感谢
答案 0 :(得分:4)
integer(1)
在PostgreSQL中不是有效的数据类型。正确的名称是integer
有关所有可用类型的完整列表,请参阅手册:
http://www.postgresql.org/docs/current/static/datatype.html
编辑:
如果要存储存储true / false的“标志”,请使用boolean
数据类型。
答案 1 :(得分:2)
CREATE TABLE "public"."users" ("id" SERIAL, "username" character varying(255), "password" character varying(255), "etat" integer, "avatar" character varying(255), "description" text, "email" character varying(255), "website" character varying(255), "country" character varying(255), "location" character varying(255), "nb_upload" integer, "sexe" character varying(25), "group_id" integer, "created" date, "modified" date, "enable_mail" integer, "enable_location" integer, "facebook_id" bigint, PRIMARY KEY ("id"))
这应该对你有用)你的意思是整数(1)?)