Re: On duplicate ignore

Поиск
Список
Период
Сортировка
От Florian Weimer
Тема Re: On duplicate ignore
Дата
Msg-id 821uqu8utt.fsf@mid.bfk.de
обсуждение исходный текст
Ответ на On duplicate ignore  ("Gnanakumar" <gnanam@zoniac.com>)
Список pgsql-general
* Lincoln Yeoh:

> Is there a simple way to get postgresql to retry a transaction, or
> does the application have to actually reissue all the necessary
> statements again?

The application has to re-run the transaction, which might result in the
execution of different statements.  In the INSERT-or-UPDATE case, the
new attempt will have to use an UPDATE instead of an INSERT, so replying
the statements verbatim will not work.

> I'd personally prefer to use locking and selects to avoid transaction
> aborts whether due to unique constraint violations or due to
> serialization violations.

Once you address the restart issue, transactional code is simpler and
easier to check for correctness.

Restarting transactions has other benefits, too.  For instance, you can
restart your PostgreSQL server process, and your applications will just
keep running.

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

Предыдущее
От: Lincoln Yeoh
Дата:
Сообщение: Re: On duplicate ignore
Следующее
От: Brice Maron
Дата:
Сообщение: Immutable function with bind value