Re: current_timestamp wrong - Mailing list pgsql-general

From Peter Pilsl
Subject Re: current_timestamp wrong
Date
Msg-id 20010823125511.D74681@i3.atat.at
Whole thread Raw
In response to Re: current_timestamp wrong  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, Aug 22, 2001 at 06:26:14PM -0400, Tom Lane wrote:

>
> current_timestamp is defined as the time of the start of the current
> transaction (this is not a bug, it's a feature).
>
> If your program is set up to hold a transaction open while it's idle,
> that could cause stale-looking values of current_timestamp when you
> finally do something in the transaction.  Unfortunately I believe that
> "autocommit off" mode in the DBD driver does exactly that.
>

the DBD-Driver does not support explicit begin-transactions. Instead
every commit and rollbackstatement issues implicit a new
begin-statement when autocommit off. (The same has obviously to
happen, when the databasehandle is opened, but it is not documented)
This and your explanation about the meaning of current_timestamp is
the perfect explanation of our bug.

I just created a fix by just issuing a rollback-statement at the
*beginning* of each workingsession. This should start a new
transaction and - I hope - dont loose to much performance.  When its
working, I'll contact Edmund Mergl, author of DBD::Pg and try to find
a better solution.

I personally would prefer a solution where one must issue explicit
begin and commit/rollback and each action in between will cause an
error when autocommit->off.

thnx a lot.
peter


--
mag. peter pilsl

phone: +43 676 3574035
fax  : +43 676 3546512
email: pilsl@goldfisch.at
sms  : pilsl@max.mail.at

pgp-key available

pgsql-general by date:

Previous
From: Carfield Yim
Date:
Subject: Where can I find more information of MVCC?
Next
From: "Oliver Elphick"
Date:
Subject: Re: SELECT FOR UPDATE