A very simple question about rollback/commit

From: "Della-Croce, Gregory" <Greg_Della-Croce(at)wycliffe(dot)org>
To: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: A very simple question about rollback/commit
Date: 2012-07-09 15:09:58
Message-ID: F1CFB1E7A51CD846898BB039F441E04F0960B38FC0@elijah
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am new to working with PostgreSQL and need to create a pgSQL process that I can run against a 8.4 PostgreSQL database. The code will need to look something like:
BEGIN;
SAVEPOINT sp1;
UPDATE location SET delete = 1 WHERE delete=0 RETRUNING count;
[code to rollback if there is an error or commit if everything was good]

It is that code for knowing that there was an error and doing the Rollback that I can't remember how to do. I looked through the PostgreSQL Documentation for an example but I couldn't find it. It has been a very long time since I wrote SQL code.

Oh, another small question, since this is not being embedded in an program like C#, VB, etc, the two tool I have are pgADMIN III and SSH. Can this be done in pgADMIN III?

Thanks to those that will help me with a simple solution.

Greg Della-Croce
Applications Administrator

Greg_Della-Croce(at)Wycliffe(dot)org
SKYPE: GDellaCroce55
Cell: 407-408-2572
THINK ON THIS:
"All that is valuable in human society depends upon the opportunity for development accorded the individual" ~ Albert Einstein
"All this is valuable in Christ's Kingdom depens upon the opportunity for development accorded the individual by the Holy Spirit to Glorify the Father" ~ Greg Della-Croce

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message JORGE MALDONADO 2012-07-10 17:37:44 How to apply a regular expression to a select statement
Previous Message Ioannis Anagnostopoulos 2012-07-08 22:56:07 Re: Aggregate from CASE WHEN...