| От | Gary Doades |
|---|---|
| Тема | Re: serialization errors when inserting new records |
| Дата | |
| Msg-id | 41F23F8B.7090809@gpdnet.co.uk обсуждение исходный текст |
| Ответ на | serialization errors when inserting new records (Ralph van Etten <ralph@et10.org>) |
| Список | pgsql-general |
Ralph van Etten wrote: > 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.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера