Re: Select for insert possible?

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: Lincoln Yeoh
Дата:
Сообщение: Select for insert possible?
Следующее
От: "Matt Friedman"
Дата:
Сообщение: Baffled by "Group By" - Please help!