Re: Solution to UPDATE or INSERT Problem
| От | Tom Lane |
|---|---|
| Тема | Re: Solution to UPDATE or INSERT Problem |
| Дата | |
| Msg-id | 20893.1074490456@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Solution to UPDATE or INSERT Problem (Curt Sampson <cjs@cynic.net>) |
| Список | pgsql-general |
Curt Sampson <cjs@cynic.net> writes:
> On Mon, 19 Jan 2004, Tom Lane wrote:
>> You're quite mistaken. Have you made any effort to test it?
> Yes. You appear to have changed my code somewhat:
> ...
> Take out that BEGIN.
The BEGIN was merely a convenient way of slowing down operations enough
so that a trivial manual test would expose the problem. Concurrent
executions of that INSERT/SELECT *will* fail, it's just a matter of
getting them to actually overlap in time. With BEGIN the window for
concurrency failures is wider than without --- but it's not zero without.
> Yup. You re-created the race condition that I'd gotten rid of when you
> put the INSERT and the UPDATE into the same transaction.
You need to go back and re-read the documentation... the UPDATE does not
actually have anything to do with the failure.
regards, tom lane
В списке pgsql-general по дате отправления: