473,387 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

will I need nested transactions ?

Hi,

will I need "nested transactions" which - as I read - aren't
implemented, yet ?

I have some objects that rely on each other.
Each has a status like proposal, working, canceled.

table-A <--- table-B <--- table-C <--- table-D

Those are (1, OO) relationships,
A status change above gets cascaded down but not upwards.
If I try to cancel a table-A-record every "lower" record in B, C, D
should be canceled, too, when the transaction is committed.
Since it is possible, that I cancel e.g. a table B object only its
children should get updated but not table-A.

I thought somthing along this to cancel a type B object:

BEGIN
BEGIN
BEGIN
UPDATE table-D
END
if no error UPDATE table-C
END
if no error UPDATE table-B
END

Does this make sense and will it provide the necesary protection ?

BTW the client is Access 2000 via ODBC talking to an PostgreSQL 7.4.2 on
Linux.
Regards
Andreas

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #1
2 1891
Andreas wrote:
Hi,

will I need "nested transactions" which - as I read - aren't
implemented, yet ?

I have some objects that rely on each other.
Each has a status like proposal, working, canceled.

table-A <--- table-B <--- table-C <--- table-D

Those are (1, OO) relationships,
A status change above gets cascaded down but not upwards.
If I try to cancel a table-A-record every "lower" record in B, C, D
should be canceled, too, when the transaction is committed.
Since it is possible, that I cancel e.g. a table B object only its
children should get updated but not table-A.

I thought somthing along this to cancel a type B object:

BEGIN
BEGIN
BEGIN
UPDATE table-D
END
if no error UPDATE table-C
END
if no error UPDATE table-B
END

Does this make sense and will it provide the necesary protection ?


I don't think it needs to be that complicated. Just wrap the whole lot
in one transaction and it will either all work or all fail:

BEGIN
UPDATE table_d ...
UPDATE table_c ...
UPDATE table_d ...
COMMIT;

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2
Ben
If you want the model where if any updates fail, all should be rolled
back, then you don't need nested transactions, just multiple aborts:

begin;
update d; if error abort;
update c; if error abort;
...
commit;

On Mon, 17 May 2004, Andreas wrote:
Hi,

will I need "nested transactions" which - as I read - aren't
implemented, yet ?

I have some objects that rely on each other.
Each has a status like proposal, working, canceled.

table-A <--- table-B <--- table-C <--- table-D

Those are (1, OO) relationships,
A status change above gets cascaded down but not upwards.
If I try to cancel a table-A-record every "lower" record in B, C, D
should be canceled, too, when the transaction is committed.
Since it is possible, that I cancel e.g. a table B object only its
children should get updated but not table-A.

I thought somthing along this to cancel a type B object:

BEGIN
BEGIN
BEGIN
UPDATE table-D
END
if no error UPDATE table-C
END
if no error UPDATE table-B
END

Does this make sense and will it provide the necesary protection ?

BTW the client is Access 2000 via ODBC talking to an PostgreSQL 7.4.2 on
Linux.
Regards
Andreas

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim Rosenberg | last post by:
How realistic is it to expect nested transactions to make it into PostgreSQL 7.5? I can't think of anything I've heard of in the works for 7.5 that comes close in importance -- with the possible...
0
by: P. Emigh | last post by:
A client that synchronizes over the internet encountered Error #3003: "Could not start transaction; too many transactions already nested" when attempting to synchronize. I checked user groups...
1
by: Neil | last post by:
Does anyone know where there is some examples of nested datagrids in vb.net not using ASP.net or Does anyone know how to link using nested datagrids in vb.net not using ASP.net (eg where...
9
by: John Sidney-Woollett | last post by:
Is it possible to use the dblink and dblink_exec features from inside pl/pgsql functions to mimic the behaviour of nested transactions by calling another function or executing some SQL via the...
6
by: Thapliyal, Deepak | last post by:
Hi, Assume I have a bank app.. When customer withdraws $10 from his accouint I have to do following --> update account_summary table --> update account detail_table Requirement: either...
2
by: Gerrit.Horeis | last post by:
Hi All, I have a problem with nested SQLQueries. I will give here an abstract sample of code which I wrote Method A { createSqlTransaction and call SQL Insert Statement including "Select...
1
by: Mana | last post by:
Hi, I want to implement nested transactions in C#. When I write BEGIN TRANSACTION inside another BEGIN TRANSACTION in an SQL Script it works fine. But when I call BeginTransaction() inside...
3
by: hrreece | last post by:
I am trying to use the Dlookup expression in a macro to pull the value from the "Price" field in the following query. The query works fine and the Dlookup function did as well until I added a new...
1
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all I have problems loading XML data into SQL Server. What is the best way to go ? I am new in using XML documents. I have tried to do it with "Integration Services" and also with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.