A very simple question about rollback/commit - Mailing list pgsql-novice

From Della-Croce, Gregory
Subject A very simple question about rollback/commit
Date
Msg-id F1CFB1E7A51CD846898BB039F441E04F0960B38FC0@elijah
Whole thread Raw
Responses Re: A very simple question about rollback/commit  (Jeff Davis <pgsql@j-davis.com>)
List 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@Wycliffe.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

 

pgsql-novice by date:

Previous
From: Ioannis Anagnostopoulos
Date:
Subject: Re: Aggregate from CASE WHEN...
Next
From: JORGE MALDONADO
Date:
Subject: How to apply a regular expression to a select statement