Re: Re: Why is unique constraint needed for upsert? (treat atomicity as optional)
В списке pgsql-general по дате отправления:
| От | John R Pierce |
|---|---|
| Тема | Re: Re: Why is unique constraint needed for upsert? (treat atomicity as optional) |
| Дата | |
| Msg-id | 53D03B16.9020503@hogranch.com обсуждение исходный текст |
| Ответ на | Re: Re: Why is unique constraint needed for upsert? (treat atomicity as optional) (Seamus Abshere <seamus@abshere.net>) |
| Ответы |
Re: Re: Why is unique constraint needed for upsert? (treat
atomicity as optional)
|
| Список | pgsql-general |
On 7/23/2014 3:29 PM, Seamus Abshere wrote: > My argument lives and dies on the assumption that UPSERT would be > useful even if it was (when given with no options) just a macro for > >> UPDATE db SET b = data WHERE a = key; >> IF NOT found THEN >> INSERT INTO db(a,b) VALUES (key, data); >> END IF; but that won't work if two connections execute similar 'upserts' concurrently. both updates will see the record isn't there, then one or the other insert will fail, depending on which transaction commits first. -- john r pierce 37N 122W somewhere on the middle of the left coast
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера