dbTalk Databases Forums  

Nested Transactions

comp.databases.postgresql comp.databases.postgresql


Discuss Nested Transactions in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #91  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM






Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
  #92  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM






Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
  #93  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM



Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
  #94  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM



Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
  #95  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM



Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
  #96  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM



Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
  #97  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Nested Transactions - 10-02-2008 , 06:58 AM



Laurenz Albe <invite (AT) spam (DOT) to.invalid> wrote:
Quote:
You are right, I did not think of that - all statements in a BEGIN ...
EXCEPTION block that were executed before the exception occurred will not
be rolled back.

In autocommit mode there is also an active transaction; all statements in
a function run in that same transaction.

So basically what you would like are SAVEPOINT and ROLLBACK TO SAVEPOINT
statements in a function, right?

Maybe you could ask the pgsql-hackers list if this would be a good
feature to add.
i *did* bring it up on the pgsql-general list, and I found that I was
wrong: the savepoint in a BEGIN ... EXCEPTION block is actually set at
the BEGIN.

So if any statement in the block causes an exception that is caught,
*all* the statements within the block will be undone.

So PostgreSQL actually does implement subtransactions the way you want
them.

See the mailing list archives which also contain examples:

http://archives.postgresql.org/pgsql...0/msg00061.php
http://archives.postgresql.org/pgsql...0/msg00068.php

Yours,
Laurenz Albe


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.