Search Postgresql Archives

duplicate key violates unique constraint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 sometimes, I would say 1 in 10 tries, when I use a INSERT
command I get the following error:

"duplicate key violates unique constraint"

The INSERT query is that:
"INSERT INTO projects (\"project_name\", \"username\") VALUES ('$project_name',
'$username')";

Can someone help me please?!!

Thanks,
Verônica




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux