Re: Named transaction

From: Pavel Golub <pavel(at)microolap(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pavel(at)gf(dot)microolap(dot)com, Andrew Dunstan <andrew(at)dunslane(dot)net>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Greg Stark <stark(at)enterprisedb(dot)com>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, Joshua D(dot) Drake <jd(at)commandprompt(dot)com>(Command Prompt, Inc(dot)), David E(dot) Wheeler <david(at)kineticode(dot)com>
Subject: Re: Named transaction
Date: 2009-06-18 06:42:32
Message-ID: 1947603015.20090618094232@gf.microolap.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello.

You wrote:

TL> Pavel Golub <pavel(at)microolap(dot)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(at)gf(dot)microolap(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2009-06-18 07:10:55 Re: machine-readable explain output
Previous Message Simon Riggs 2009-06-18 06:38:27 Re: [HACKERS] Cannot use all four trigger events at once