I think this question may be more appropriate for [EMAIL PROTECTED] Anyrate for the below. Sounds like you maybe already have a table or sequence called ai_id;
Try doing a DROP SEQUENCE ai_id; First Also if you plan to use this sequence only for this table it would be better to use serial8 which will automatically create the sequence for you. Then you don't even need that first part. Also you should avoid naming fields things like Date which tend to be keywords in many kinds of databases. Try changing your logic to something like CREATE TABLE badusers ( id serial8, UserName varchar(30), Date timestamp DEFAULT now() NOT NULL, Reason varchar(200), Admin varchar(30) DEFAULT '-', PRIMARY KEY (id) ); CREATE INDEX badusers_username ON badusers USING btree (username); CREATE INDEX badusers_date ON badusers USING btree (date); -----Original Message----- From: R, Rajesh (STSD) [mailto:[EMAIL PROTECTED] Sent: Thursday, September 29, 2005 9:05 AM To: pgsql-hackers@postgresql.org; pgsql-performance@postgresql.org Subject: [HACKERS] Query in SQL statement Am trying to port a mysql statement to postgres. Please help me in finding the error in this, CREATE SEQUENCE ai_id; CREATE TABLE badusers ( id int DEFAULT nextval('ai_id') NOT NULL, UserName varchar(30), Date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, Reason varchar(200), Admin varchar(30) DEFAULT '-', PRIMARY KEY (id), KEY UserName (UserName), KEY Date (Date) ); Am always getting foll. Errors, ERROR: relation "ai_id" already exists ERROR: syntax error at or near "(" at character 240 Thanks, Rajesh R ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq