SET AUTOCOMMIT OFF

Started by Nonameabout 16 years ago3 messagesgeneral
Jump to latest
#1Noname
A.Bhattacharya@sungard.com

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.

Many thanks for help!

#2Andreas Kretschmer
akretschmer@spamfence.net
In reply to: Noname (#1)
Re: SET AUTOCOMMIT OFF

A.Bhattacharya@sungard.com <A.Bhattacharya@sungard.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.

Do you using psql as client?

\set AUTOCOMMIT off

You can set that in your ~/.psqlrc

Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082�, E 13.56889�

#3Craig Ringer
craig@2ndquadrant.com
In reply to: Noname (#1)
Re: SET AUTOCOMMIT OFF

A.Bhattacharya@sungard.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