1

Hello I blocked in the creation of a simple table please help me using ubuntu 11.04 - PostgreSQL 8.4.8 with phppgadmin I get this code :

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)
)

but every time I execute , it return this error :

ERROR: syntax error at or near "(" LINE 1: ... "password" character varying(255), "etat" integer(1), "avat...

thanks

1
  • I'm not sure it's a great idea to be mixing different languages in an app, but I suppose it's your problem in the long run. Commented Jun 8, 2011 at 22:21

2 Answers 2

5

integer(1) is not a valid data type in PostgreSQL. The correct name is integer

See the manual for a complete list of all available types:

http://www.postgresql.org/docs/current/static/datatype.html

Edit:

If you want to store a "flag" that stores true/false use the boolean data type instead.

Sign up to request clarification or add additional context in comments.

Comments

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"))

this should work for you) by the way what do you mean by integer(1) ?)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.