Re: COMMIT in PostgreSQL

From: "Susan Lane" <suel(at)dpn(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: COMMIT in PostgreSQL
Date: 2002-07-19 22:12:01
Message-ID: aha3jv$1c2v$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks!

""scott.marlowe"" <scott(dot)marlowe(at)ihs(dot)com> wrote in message
news:Pine(dot)LNX(dot)4(dot)44(dot)0207191529000(dot)4638-100000(at)css120(dot)ihs(dot)com(dot)(dot)(dot)
> On Fri, 19 Jul 2002, Susan Lane wrote:
>
> > I have noticed this difference between Postgres and Oracle as well. I
> > wonder if there is a rollback mechanism as there is in Oracle. I mean
if
> > you use a BEGIN, can you rollback in Postgres?
>
> Yes. If you do the following:
>
> begin;
> select * from table1;
> update table2 set field1='yada' where id=1234;
> delete from table3 where id=1243;
> insert into table4 (fielda, fieldb) values ('hello',45);
> rollback;
>
> Then all the changes (except for sequence counters being incremented) will
> be rolled back.
>
> Note that if you do:
>
> begin;
> select * from ;
> insert into table (name) values('me');
> commit;
>
> The insert will fail because you had a failure in your select query.
> Unlike many other databases where data change failures are the only ones
> to automatically rollback a transaction, in postgresql, almost any error
> in a transaction will cause it to rollback.
>
> Note that postgresql does NOT support nested transactions either.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-07-19 22:12:38 Re: Modifying column size
Previous Message Susan Lane 2002-07-19 22:10:54 Re: Modifying column size