Re: strange commit behavior

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: strange commit behavior
Дата
Msg-id 4922C24A.8090409@postnewspapers.com.au
обсуждение исходный текст
Ответ на strange commit behavior  ("Flavio Palumbo" <f.palumbo@silmasoftware.com>)
Ответы Re: strange commit behavior  ("Grzegorz Jaśkiewicz" <gryzman@gmail.com>)
Список pgsql-general
Flavio Palumbo wrote:

> Unfortunately postgres seems to work in a different way, cause if there is
> just one error while the transaction is active I'm not able to commit the
> well formed data in the db, no matter if the good records were inserted
> sooner or later the error.

Yes, that's right. As soon as something goes wrong in the transaction
it's assumed that, unless you handle the error, the transaction is bad
and shouldn't be committed.

You can use savepoints (see the manual) to recover from errors, though
they have some issues if you use hundreds of thousands of savepoints in
a single transaction. It's much better to check the data on INSERT to
make sure it's OK. You can do this with an INSERT ... SELECT (and check
the rowcount), with a PL/PgSQL function that returns a result value, do
it client-side, etc.

--
Craig Ringer

В списке pgsql-general по дате отправления:

Предыдущее
От: Gustavo Rosso
Дата:
Сообщение: Urgent - Grant
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Urgent - Grant