Re: Weird behavior in transaction handling (Possible bug ?)

Поиск
Список
Период
Сортировка
От Csaba Nagy
Тема Re: Weird behavior in transaction handling (Possible bug ?)
Дата
Msg-id 1105721842.14493.52.camel@localhost.localdomain
обсуждение исходный текст
Ответ на Re: Weird behavior in transaction handling (Possible bug ?) -- commit fails silently  ("j.random.programmer" <javadesigner@yahoo.com>)
Ответы Re: Weird behavior in transaction handling (Possible bug ?) -- commit fails silently
Список pgsql-jdbc
Dear random programmer,

I understand your grief perfectly, and agree completely, I've been
there. But I think the spec is at least ambiguous about this matter, if
not leaning towards the postgres behavior of rolling back everything on
an error. And I don't believe commit fails silently, it should give you
an error.
The demand for the convenience of deciding after a failed query to
continue or not comes from other DB engines readily implementing it
(notably Oracle). So I would expect you're coming from an oracle DB
experience...
In any case, if you want similar behavior in postgres > 8.0, you could
use a savepoint before the auxialiary query and roll back to it on an
error. Then the result of the queries before the savepoint can be
committed.
Please note that setting a savepoint in postgres is not nearly free, so
be careful how often you do it.

HTH,
Csaba.


 Fri, 2005-01-14 at 17:29, j.random.programmer wrote:
> > With postgres once an error occurs in a transaction
> block you need
> > to rollback. None of the transaction will commit.
> >
> > This behaviour makes sense as it assumes that the
> transaction block
> > is atomic and it should all succeed or all fail.
>
>
> This is VERY counter-intuitive. I can have really
> important data
> for say 5 tables which has committed properly but at
> the 6th
> insert into a non-important auxillary table, I may
> encounter a
> transient exception. I still want to be able to commit
> my data.
>
> There are many similar scenarios such as the above,
> right ?
>
> As a programmer, shouldn't it be upto me to decide
> when to
> commit and when to rollback ?  Is this even within
> spec ? And
> at the very least, commit() should then not fail
> SILENTLY ! (and
> this should be documented).
>
> :-]
>
> Best regards,
>
> --j
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.
> http://promotions.yahoo.com/new_mail
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org


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

Предыдущее
От: Vadim Nasardinov
Дата:
Сообщение: Re: Weird behavior in transaction handling (Possible bug ?)
Следующее
От: "j.random.programmer"
Дата:
Сообщение: Re: Weird behavior in transaction handling (Possible bug ?) -- commit fails silently