473,666 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #1
2 1901
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*******@postg resql.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 YourEmailAddres sHere" to ma*******@postg resql.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
1417
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 exception of a native Windows port. There are just *so many* cases where you want to be able to have a stored procedure that spans multiple transactions -- having nested transactions allows saving a whole architecture tier. Without them,...
0
4025
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 and MS Knowledge Base and found nothing helpful. This didn't seem to be acknowledged as a synchroization error. Investigations revealed data errors that resulted in a cascade of related errors. Resolving the data errors apparently cured whatever...
1
1160
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 column 1 is a date and the column 2 is a datagrid that has transactions belonging to that date)
9
7600
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 dblink (into the same database)? Does the SQL statement executed within the dblink sit in its own isolated transaction/session? And would an error thrown in the dblink statement abort the enclosing session that initiated the call? What is the...
6
3172
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 both transactions should succeed or both transactions should be rolled back in case of failure.
2
1951
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 ScopeIdentity();" try {
1
18838
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 another BeginTransaction() in a c# code on same connection object it throws exception as "SQLConnection doesnot support parallel transaction". Following is the code snippet that i have written.
3
2449
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 field to the "Contracts" table called "ContractYear". SELECT Contracts.ID, Contracts.Commodity, Contracts.Date, Contracts.ContractYear, Contracts.Option, Contracts., Contracts.Bushels, Contracts.Price, Contracts. FROM Customer INNER JOIN Contracts...
1
1716
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 "XmlTextReader", "XPathDocument", "DataSet.ReadXML" ... None of this is working well because my XML document has nested tables and in XML documents I dont see any relations ...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.