Re: Working around spurious unique constraint errors due to SERIALIZABLE bug
| От | Florian Weimer |
|---|---|
| Тема | Re: Working around spurious unique constraint errors due to SERIALIZABLE bug |
| Дата | |
| Msg-id | 824ot7my9o.fsf@mid.bfk.de обсуждение исходный текст |
| Ответ на | Re: Working around spurious unique constraint errors due to SERIALIZABLE bug ("Albe Laurenz" <laurenz.albe@wien.gv.at>) |
| Список | pgsql-general |
* Albe Laurenz: > The original question asked was "how can I tell an error that is caused > by incomplete isolation from another error?" > > If you have a code segment like > SELECT COUNT(id) INTO i2 FROM a WHERE id = i; > IF i2 = 0 THEN > INSERT INTO a (id) VALUES (i); > END IF; > > Then you can be certain that any "unique_violation" thrown here must > be a serialization problem (if the only unique contraint is on "id"). I want to put this into a library, so I'd like something foolproof. Right now, user code sets a flag which basically says that the wrapper should retry the transaction a few times if a unique_violation is detected, but I'd like to get rid of that because it's one thing less the programmer needs to worry about. -- Florian Weimer <fweimer@bfk.de> BFK edv-consulting GmbH http://www.bfk.de/ Kriegsstraße 100 tel: +49-721-96201-1 D-76133 Karlsruhe fax: +49-721-96201-99
В списке pgsql-general по дате отправления: