| От | Tom Lane |
|---|---|
| Тема | Re: Select for insert possible? |
| Дата | |
| Msg-id | 23206.985456791@sss.pgh.pa.us обсуждение |
| Ответ на | Select for insert possible? (Lincoln Yeoh <lyeoh@pop.jaring.my>) |
| Ответы |
Re: Select for insert possible?
|
| Список | pgsql-general |
Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
> Is it technically possible for there to be a "select for insert"? e.g.
> other select for inserts with the same effective where clause will block
> even if no rows are there yet.
What would you define as the "same effective where clause"? Shades of
the halting problem, I think :-(.
I'd recommend grabbing a table-level EXCLUSIVE MODE lock, which will
allow reads to proceed but lock out other updaters.
Alternatively, consider whether you can't rely on a unique index to
prevent multiple processes from inserting the "same" not-there-yet row.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера