Re: different transaction handling between postgresql and

Поиск
Список
Период
Сортировка
От Peter Childs
Тема Re: different transaction handling between postgresql and
Дата
Msg-id Pine.LNX.4.44.0307140854410.7730-100000@RedDragon.Childs
обсуждение исходный текст
Ответ на different transaction handling between postgresql and oracle/mysql  (Jörg Schulz <jschulz@sgbs.de>)
Ответы Re: different transaction handling between postgresql and oracle/mysql  (Jörg Schulz <jschulz@sgbs.de>)
Список pgsql-general
On Mon, 14 Jul 2003, Jörg Schulz wrote:

> Suppose the following:
>
> create table test (a int primary key);
> insert into test values (1);
>
> select * from test;
> a
> =
> 1
>
> In Postgresql if you do the following in a transaction (either with
> autocommit=off or with an explizit begin):
>
> insert into test values (2); -> ok
> insert into test values (1); -> error (duplicate key)
> insert into test values (3); -> error (transaction aborted)
> commit;
>
> You get:
>
> select * from test;
> a
> =
> 1
>
>
> In Oracle/MySQL if you do the same you get:
>
> insert into test values (2); -> ok
> insert into test values (1); -> error (duplicate key)
> insert into test values (3); -> ok
> commit;
>
> select * from test;
> a
> =
> 1
> 2
> 3
>
> Which behavior is right?

    The first I believe

    Transactions have to be committed in there entirety or not at all.
MySql does not do transactions on its standard tables anyway you have to
switch them on at table create time (early versions could not cope with
them at all!) I have this feeling the reason Oracle gives this result may
be again because transactions have been switched off. If you want the
second result in Postgres just switch auto-commit on!

Peter Childs


> Is there a way to make Postgresql behave like the other databases?
> Which other Databases act like Postgresql and which do it like Oracle/MySQL?
>
> Jörg
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: different transaction handling between postgresql and oracle/mysql
Следующее
От: Adam Witney
Дата:
Сообщение: Re: OS X installation with readline support