Re: #Personal#: Reg: Multiple queries in a transaction

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: #Personal#: Reg: Multiple queries in a transaction
Date: 2015-02-19 07:56:04
Message-ID: 1424332564656-5838539.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Medhavi Mahansaria wrote
> Hi Bill,
>
> Thanks!
>
> But savepoint concept will not work for me as desired.
>
> Is there any other way apart from SAVEPOINT that can be incorporated.
>
> I am not using a script. I am writing a c++ program.
>
> My problem is that I have 2 cases:
>
> Case 1: When Q2 fails (we delete the error), i want to continue to Q3 and
> commit changes done by Q1 and Q3 once Q3 has executed successfully.
>
> Case 2: When Q2 fails, I want it to throw an error. and rollback the
> changes made by Q1 and not proceed to Q3 at all.
>
> Note: This is just a small example. I need a solution for an entire
> application which follows the same concept across multiple queries.
>
> How can I incorporate this?

Forgo transactions or use savepoints. Those are your tools. If you cannot
find a way to solve your problem with those tools you either need to choose,
or build, a different toolbox or explain your actual problem in greater
detail so that others can see if there are solutions you are overlooking.

Or redefine your problem.

David J.

--
View this message in context: http://postgresql.nabble.com/Personal-Reg-Multiple-queries-in-a-transaction-tp5838427p5838539.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2015-02-19 08:00:28 Re: #Personal#: Reg: Multiple queries in a transaction
Previous Message Medhavi Mahansaria 2015-02-19 05:42:38 Re: #Personal#: Reg: Multiple queries in a transaction