Hoi,
I searched the archives but couldn't find an answer to this:
I have a table (simplyfied)
CREATE TABLE test ( id INT PRIMARY KEY, name VARCHAR(250) );
I insert records with
INSERT INTO test (id, name) SELECT COALESCE(MAX(id)+1, 1), 'name' FROM test
Ofcourse this gives problems when two clients are inserting a record at the same time. (duplicate primary keys) But, i can't use a sequence in my application (the pk consists of more than just a sequence)
It's not clear why you can't use a serial as the primary key or as part of the primary key. From your example it looks like you are trying to do exactly that.
What does your *real* primary key consist of?
Cheers, Gary.
---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?
http://archives.postgresql.org