Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug?
В списке pgsql-general по дате отправления:
| От | Reece Hart |
|---|---|
| Тема | Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug? |
| Дата | |
| Msg-id | 1190696565.20315.22.camel@snafu обсуждение исходный текст |
| Ответ на | Re: Why the ERROR: duplicate key violates uniqueconstraint "master_pkey" is raised? - Is this a Bug? ("Anoo Sivadasan Pillai" <aspillai@in.rm.com>) |
| Список | pgsql-general |
But since you can’t control the order, it is likely that the operation will sometimes and will succeed sometimes, with the same data.. Weird I feel .Not so weird (IMO). Many databases will return rows unordered unless you specify otherwise. Once one understands that uniqueness constraints are evaluated immediately and that rows are visited unordered, it's not so weird.
The work around given by you will work, Does it mean that whenever we are updating a unique key we have to take this precaution ?Probably. I suspect that you're using unique or primary keys to imply some meaning that would be better stored elsewhere, and definitely NOT in a primary key. Perhaps you should consider refactoring your design. You're doing something wrong if you find that you need to update primary keys routinely.
-- Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0 |
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера