Thread: Commit Transaction Command

Commit Transaction Command

From
"Jim Wilson"
Date:
The debug logs seem a little confusing.   On sending a query something like
this will show up:

DEBUG: StartTransactionCommand
LOG: query: select * from blah;
DEBUG: ProcessQuery
DEBUG: CommitTransactionCommand

This is with auto commit off.  My first reaction on seeing this was the auto
commit setting must not work.  Then I noticed that most things,  even "begin"
and "commit" commands entered via the query interface in psql were wrapped
with the same "DEBUG" output.  And finally I did some testing and found that
transactions did in fact work correctly.

I am hoping that someone can enlighten me as to what this DEBUG output
actually indicates.

Running version 7.3.5.

Thanks,

Jim Wilson


Re: Commit Transaction Command

From
Pierre-Frédéric Caillaud
Date:
    If you don't explicitly BEGIN, the interface (psql) will wrap every of
your commands in a transaction.



On Fri, 6 Aug 2004 01:44:05 -0000, Jim Wilson <jimw@kelcomaine.com> wrote:

> The debug logs seem a little confusing.   On sending a query something
> like
> this will show up:
>
> DEBUG: StartTransactionCommand
> LOG: query: select * from blah;
> DEBUG: ProcessQuery
> DEBUG: CommitTransactionCommand
>
> This is with auto commit off.  My first reaction on seeing this was the
> auto
> commit setting must not work.  Then I noticed that most things,  even
> "begin"
> and "commit" commands entered via the query interface in psql were
> wrapped
> with the same "DEBUG" output.  And finally I did some testing and found
> that
> transactions did in fact work correctly.
>
> I am hoping that someone can enlighten me as to what this DEBUG output
> actually indicates.
>
> Running version 7.3.5.
>
> Thanks,
>
> Jim Wilson
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



Re: Commit Transaction Command

From
Alvaro Herrera
Date:
On Fri, Aug 06, 2004 at 01:44:05AM -0000, Jim Wilson wrote:
> The debug logs seem a little confusing.   On sending a query something like
> this will show up:
>
> DEBUG: StartTransactionCommand
> LOG: query: select * from blah;
> DEBUG: ProcessQuery
> DEBUG: CommitTransactionCommand

The CommitTransactionCommand function actually means "stop processing
the command we just received".  If said command was a COMMIT or
ROLLBACK, then it will also commit the transaction (resp. abort it).  If
it wasn't, then the transaction will be kept open.  So you have nothing
to worry about, short of a loglevel set up a little too high ;-)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Coge la flor que hoy nace alegre, ufana. ¿Quién sabe si nacera otra mañana?"