Thread:

From
"Mona"
Date:
Hi
 

We are trying to rollback an update in postgres. But so far we have not been able to do it.
When we Rollback..
it says:
 
ROLLBACK: No transaction in progress.
 
Same happens with commit.
We are used to SQL PlUS
 
Without these facilities we really cannot go ahead with postgres db. Could you please help us out on this.
 
 
 
Thanks
mlisa

Re:

From
Doug McNaught
Date:
"Mona" <mlisa@bisil.com> writes:

> We are trying to rollback an update in postgres. But so far we have not been able to do it.
> When we Rollback..
> it says:
>
> ROLLBACK: No transaction in progress.

This means you haven't started a transaction.  Use BEGIN to start one
before you do your updates.

This is completely standard SQL.

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
   --T. J. Jackson, 1863

Re:

From
patrick keshishian
Date:
Try:

   begin;
   update TABLE set FIELDx = VALUEy
   rollback;


On Sat, Oct 13, 2001 at 12:02:01PM +0530, Mona wrote:
>
> We are trying to rollback an update in postgres. But so far we have not been able to do it.
> When we Rollback..
> it says:
>
> ROLLBACK: No transaction in progress.
>
> Same happens with commit.
> We are used to SQL PlUS
>
> Without these facilities we really cannot go ahead with postgres db. Could you please help us out on this.

--
patrick keshishian

Gnu  __   _
 -o)/ /  (_)__  __ ____  __
 /\\ /__/ / _ \/ // /\ \/ /
_\_v __/_/_//_/\_,_/ /_/\_\

Re:

From
"Oliver Elphick"
Date:
"Mona" wrote:
  >We are trying to rollback an update in postgres. But so far we have not bee=
  >n able to do it.
  >When we Rollback..
  >it says:
  >
  >ROLLBACK: No transaction in progress.
  >
  >Same happens with commit.

Each INSERT, UPDATE, COPY or DELETE is its own transaction unless a
transaction is explicitly started with BEGIN.

junk=# insert into s (name) values ('some junk');
INSERT 27805072 1
junk=# rollback;
NOTICE:  ROLLBACK: no transaction in progress
ROLLBACK
junk=# begin;
BEGIN
junk=# insert into s (name) values ('some more junk');
INSERT 27805073 1
junk=# rollback;
ROLLBACK
junk=# select * from s;
 id |   name
----+-----------
  2 | some junk
(1 row)


--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "But be ye doers of the word, and not hearers only,
      deceiving your own selves."              James 1:22



Re:

From
Martijn van Oosterhout
Date:
On Sat, Oct 13, 2001 at 12:02:01PM +0530, Mona wrote:
> Hi
>
>
> We are trying to rollback an update in postgres. But so far we have not been able to do it.
> When we Rollback..
> it says:
>
> ROLLBACK: No transaction in progress.

You have to use BEGIN to start a transaction first...

HTH,
--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

Re:

From
John Clark Naldoza y Lopez
Date:
Hello Mona,



The default behavior of PostgreSQL, AFAIK, is an autocommit
mechanism...  No transactions....  If you want to start a
transaction...  Then you'll definitely have to say...

BEGIN [ WORK | TRANSACTION ]
COMMIT [ WORK | TRANSACTION ]
END [ WORK | TRANSACTION ]
ROLLBACK [ WORK | TRANSACTION ]

These work fine for me... =)  Unfortunately (or fortunately) I'm not
using any special tools...  Just my vi, psql, pgaccess... =)

Hope that helps.


Cheers,


John Clark
--
     /) John Clark Naldoza y Lopez                           (\
    / )    Software Design Engineer III                      ( \
  _( (_    _  Web-Application Development                    _) )_
 (((\ \>  /_>    Cable Modem Network Management System <_\  </ /)))
 (\\\\ \_/ /         NEC Telecom Software Phils., Inc.  \ \_/ ////)
  \       /                                              \       /
   \    _/  phone: (+63 32) 233-9142 loc. 3113            \_    /
   /   /  cellphone: (+63 919) 399-4742                     \   \
  /   / email: njclark@ntsp.nec.co.jp                        \   \


"Intelligence is the ability to avoid doing work, yet getting the work
done"
--Linus Torvalds

Re:

From
"Dave Cramer"
Date:
you have to start a transaction with begin
 
Dave
-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Mona
Sent: October 13, 2001 2:32 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL]

Hi
 

We are trying to rollback an update in postgres. But so far we have not been able to do it.
When we Rollback..
it says:
 
ROLLBACK: No transaction in progress.
 
Same happens with commit.
We are used to SQL PlUS
 
Without these facilities we really cannot go ahead with postgres db. Could you please help us out on this.
 
 
 
Thanks
mlisa

Re:

From
Jan Poslusny
Date:
Hi Mona,
you have to start transaction firstly,
testdb=#begin;
,then do some select, insert, update etc., then
testdb=#rollback;
or
testdb=#commit;

all commands outside transaction are autocommited.

pajout

Mona wrote:

> Hi
>
>
>
>
> We are trying to rollback an update in postgres. But so far we have not
> been able to do it.
> When we Rollback..
> it says:
>
>
>
> ROLLBACK: No transaction in progress.
>
>
>
> Same happens with commit.
> We are used to SQL PlUS
>
>
>
> Without these facilities we really cannot go ahead with postgres db.
> Could you please help us out on this.
>
>
>
>
>
>
>
> Thanks
>
> mlisa
>