| От | Mage |
|---|---|
| Тема | Re: isn't "insert into where not exists" atomic? |
| Дата | |
| Msg-id | 4D4B3F5A.5090703@mage.hu обсуждение исходный текст |
| Ответ на | Re: isn't "insert into where not exists" atomic? (pasman pasmański <pasman.p@gmail.com>) |
| Ответы |
Re: isn't "insert into where not exists" atomic?
|
| Список | pgsql-general |
On 02/03/2011 10:35 PM, pasman pasmański wrote:
> Your trigger is wrong. You try to insert the same row twice.
>
I assume you didn't try it. If active_at field is null then the trigger
does another insert instead of the original one. This avoids looping or
inserting twice.
The only mistake is that I tought the insert with select will be atomic
and I was wrong. So the trigger has concurrency problem in
multi-threaded environment. It runs flawlessly in single thread and it
does only a single insert.
Mage
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера