Re: SET AUTOCOMMIT OFF

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: A(dot)Bhattacharya(at)sungard(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SET AUTOCOMMIT OFF
Date: 2010-01-18 07:00:51
Message-ID: 4B540723.1070005@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

A(dot)Bhattacharya(at)sungard(dot)com wrote:
> Hi All,
>
>
>
> I am new to Postgresql and I need to turn off the AUTO COMMIT in
> PostgreSQL 8.3.Can anyone guide me how to do it as SET AUTOCOMMIT = off;
> does not seem to be supported any more in PostgreSQL 8.3.

Just explicitly begin a transaction, like you do in most databases:

BEGIN;
INSERT ...
UPDATE ...
COMMIT;

Are you perhaps using PostgreSQL from JDBC or ODBC? If so, those client
interfaces provide their own ways to manage the "autocommit" setting -
which internally just tells the driver to create a transaction and not
commit it until you ask it to.

One thing to understand by the way: If you're not running a statement in
an explicit transaction, it just creates its own transaction when it
starts, runs, then commits automatically when it finishes. There's no
functional difference between:

BEGIN;
INSERT ...;
COMMIT;

and a stand-alone:

INSERT ...;

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2010-01-18 07:01:37 Re: postgres external table
Previous Message Andreas Kretschmer 2010-01-18 06:58:07 Re: SET AUTOCOMMIT OFF