| От | Chris Travers |
|---|---|
| Тема | Re: User-specific sequences... |
| Дата | |
| Msg-id | 019101c3ddcd$78731cf0$8d285e3d@winxp обсуждение исходный текст |
| Ответ на | User-specific sequences... ("D. Dante Lorenso" <dante@lorenso.com>) |
| Список | pgsql-general |
It would be nice if we had "Read Uncommitted" transaction level for this, hint ;-). In this scenario you will probably have to have your app check for errors and retry if you get an abort. I would do as follows: create table widgets ( customer_id int references customers, widget_id int primary key (customer_id, widget_id) ); Then I would have a trigger set to assign widget_id to (Select max(widget_id) + 1 from widgets where customer_id = new.customer_id); Then if by chance you have 2 duplicate submissions, you will get an error you ned to handle in your app by retrying the insert. Best Wishes, Chris Travers
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера