[Robert.Hufsky@ser.at: autocommit in ecpg]

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: [Robert.Hufsky@ser.at: autocommit in ecpg]
Date: 2002-01-18 15:54:09
Message-ID: 20020118155409.GF6225@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Hufsky(at)ser(dot)at> -----

From: "Robert Hufsky" <Robert(dot)Hufsky(at)ser(dot)at>
To: "Michael Meskes" <meskes(at)debian(dot)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(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-01-18 16:24:02 Re: Bug in pg_dump/restore -o
Previous Message Tom Lane 2002-01-18 15:04:41 Re: pltlc and pltlcu problems