Re: uncommited question

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Rob Brown-Bayliss <rob(at)zoism(dot)org>
Cc: PostgreSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: uncommited question
Date: 2002-08-09 17:03:47
Message-ID: Pine.LNX.4.33.0208091100500.26264-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9 Aug 2002, Rob Brown-Bayliss wrote:

>
> Hi.
>
> What happens if I don't do any commits on a connection?
>
> I am opening a connection and doing a few "selects" from the connection.
>
> I am not comiting after each query, but instead useing teh same cursor
> for another query.
>
> What then happens if I update records and the commitn from another
> connection? What about if I do some udates and inserts from this
> connection and commit them?

It looks like you've got an Oracle thinking cap on. You'll need to trade
that in on a Postgresql thinking cap.

In Oracle, when you connect, a transaction is begun for you. Then you do
whatever you want, and when you like what you have you commit, or if you
don't like it you rollback. Then another transaction begins silently for
you.

In Postgresql, there are no transactions running automatically for you
when you connect. If you issue a SQL command, postgresql will initiate a
transaction, perform the SQL, then commit / rollback the transaction
automatically, based on whether it went through or not.

In Postgresql, if you want a transaction to begin, you have to issue the
begin command yourself. Then, all the SQL you type will be in a
transaction, and you can either commit or rollback when you are done.

Hopefully that explains the difference well enough.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff MacDonald 2002-08-09 17:53:48 Re: I am being interviewed by OReilly
Previous Message Joe Conway 2002-08-09 15:41:24 Re: Stored procedures returning rowsets