[GENERAL] duplicate key violates unique constraint

2006-09-18 Thread vtaquette
Hi, I'm trying to create a table with a PRIMARY KEY. The CREATE statement looks like this: CREATE TABLE "projects" ( "project_id" serial, "username" varchar(30) NOT NULL default '', "project_name" varchar(30) NOT NULL default '', PRIMARY KEY ("project_id") ) ; The problem is that somet

Re: [GENERAL] duplicate key violates unique constraint

2006-09-19 Thread vtaquette
Hey, I've just find out what's happening. The problem is the "serial" datatype creates a sequence in the background (project_id_seq). If the sequence current numeber is 1, and I manually insert a new entry whit ID=2, the sequence doesn't "know" it. So when I try the INSERT statement, the next value