Re: dblink ,dblink_exec not participating in a Transaction??

From: carty mc <cartymc3(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: dblink ,dblink_exec not participating in a Transaction??
Date: 2008-04-01 23:56:27
Message-ID: 893148.45162.qm@web58510.mail.re3.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Just to clarify few things in the above posting.
My Main DB Client is java (using hibernate) which has Main Transaction Manager.
This one controls the overall transaction
Work flow is as follows:
1)java program updates a table in Database A
2) As a result Trigger procedure defined for this table gets executed which inturn uses dblink_exec program to update a table in Different database B.
3) Control goes back to java program.
java program will rollback the whole transaction if any errors/exceptions are found.
or else java program will issue a commit.
Java program will determine whether to commit or rollback. It is the main transaction manager.

In this case the updates that were made using dblink_exec are not getting rolled back in Database B.



carty mc <cartymc3(at)yahoo(dot)com> wrote:
How I can make dblink to participate in transaction so that remote changes made by dblink can only be committed if only local transaction succeds.

Here is my current scenario:

I am using two databases A & B. In Database A, I have trigger procedure written for a Table . In this trigger procedure, I use dblink_exec to update a table in the other database B.
The problem I am having right now is my trigger procedure currently participates in a transaction. If Transaction rollsback: whatever trigger procedure modified in database A is getting rolled back whereas Chages made to a table in Database B using dblink_exec are not.
Note: Transaction can be rolled back due to excpetions any where from main db client which updates a table in database A .

So my question is there a way to tell dblink_exec to participate in a Transaction. This way commits wont go to table in database B until transaction completed succesfully.


I appreciate any help,

thanks,

---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.


---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2008-04-02 00:31:57 Re: simple update queries take a long time - postgres 8.3.1
Previous Message x asasaxax 2008-04-01 22:43:36 Primary Key with auto increment field