[Robert.Hufsky@ser.at: autocommit in ecpg] - Mailing list pgsql-hackers

From Michael Meskes
Subject [Robert.Hufsky@ser.at: autocommit in ecpg]
Date
Msg-id 20020118155409.GF6225@feivel.credativ.de
Whole thread Raw
Responses Re: [Robert.Hufsky@ser.at: autocommit in ecpg]  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
I just got this explanation for the autocommit setting. Maybe we should add
thsi to the docs.

----- Forwarded message from Robert Hufsky <Robert.Hufsky@ser.at> -----

From: "Robert Hufsky" <Robert.Hufsky@ser.at>
To: "Michael Meskes" <meskes@debian.org>
Subject: autocommit in ecpg
Date: Fri, 18 Jan 2002 08:21:17 +0100

[...]

Transaction Control and Autocommit
An application can be operating in "autocommit on" or "autocommit off" mode.
The mode can be selected by issuing

exec sql set autocommit to on; or
exec sql set autocommit to off;

Autocommit Off

In this mode, no sql statement is ever committed unless explicitly stated by

exec sql commit;

>From the beginning of a database session an implicit transaction is open.
Each SQL statement that is issued is part of the transaction. The
transaction is closed and work is committed by exec sql commit;.

Immediately after the exec sql commit; statement a new transaction is opened
and the same rules apply.

Note that an exec sql begin; statement is not applicable in "autocommit off"
mode.

Autocommit On

In this mode, each statement is automatically committed. This can be
convinient but it also can lead to performance problems as each implicit
commit may cause a disk write operation.

Even in "autocommit on" mode, multi-statememt transactions can be achieved
by placing multiple SQL statements between

exec sql begin; and
exec sql commit;

[...]
----- End forwarded message -----

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


pgsql-hackers by date:

Previous
From: mlw
Date:
Subject: contrib: int_array_aggregator() int_array_enum()
Next
From: Tom Lane
Date:
Subject: Re: Bug in pg_dump/restore -o