Re: Named transaction

Поиск
Список
Период
Сортировка
От Pavel Golub
Тема Re: Named transaction
Дата
Msg-id 1947603015.20090618094232@gf.microolap.com
обсуждение исходный текст
Ответ на Re: Named transaction  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Named transaction  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Named transaction  (Mark Mielke <mark@mark.mielke.cc>)
Список pgsql-hackers
Hello.

You wrote:

TL> Pavel Golub <pavel@microolap.com> writes:
>> Is there any possibility that Postgres will have named transaction
>> ever, like Firebird?

TL> What in heck is a named transaction, and why should we care?
TL>                         regards, tom lane

Sorry guys, my bad. The thing is I'm not a Firebird adept either and this
is my customer's maggot. Anyway, it's interesting, so I'll try to explain.

1. He has one connection
2. He has several scripts executed simultaneously (in different
threads I think)
3. Each script must be executed inside it's own transaction

In Firebird (Interbase) he may have several transactions per one
connection each with it's own isolation level and parameters.

Each transaction in Firebird has ID (or name?). That's why I called
it "named transaction". :)

Moreover Firebird allows nested transactions
(http://wiki.firebirdsql.org/wiki/index.php?page=IN+AUTONOMOUS+TRANSACTION)


====
Now to implement customer's desire in PostgreSQL there are two ways:

1. Each script must be executed in the separate connection context

2. Each script must be executed inside critical section, in other
words current scipt must block others until COMMIT or ROLLBACK

I don't like both.

====
How I imagine "named transactions". :)

START TRANSACTION first;

INSERT ....; -- inside first

START TRANSACTION second;

DELETE ....; -- inside second

SWITCH TRANSACTION first; -- switch context

INSERT ....; -- inside first

COMMIT; -- first terminated, default context active (no transaction)

SWITCH TRANSACTION second; -- activate second transaction context

COMMIT; -- second terminated, no context active


So, what do you think guys?


-- 
With best wishes,Pavel                          mailto:pavel@gf.microolap.com



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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Cannot use all four trigger events at once
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: machine-readable explain output