Re: The jdbc and current_timestamp

From: Richard Huxton <dev(at)archonet(dot)com>
To: stevegy(at)126(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The jdbc and current_timestamp
Date: 2007-01-17 08:22:09
Message-ID: 45ADDCB1.1080502@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

stevegy(at)126(dot)com wrote:
> For example, the machine time is 11:46:xx, and I execute the SQL insert through the jdbc, the record time will be changed to 10:52:xx. I mean the time value is always slower than the machine time but not for a fixed time period.
>
> My java appserver is Sun Java appserver platform 8.2. The jdbc driver is postgresql-8.1-408.jdbc3.jar.
>
> I guess the problem may be the db connection or the connection pool. But not sure, and I tested other web java application on the same machine and same software but not DOMAIN data type on column, that has no such error. So, I modify the column to native data type: 'timestamp', but the error is still there.
>
> Anyone can help me? Thanks.

This one catches a lot of people first time they see it.

The time is fixed at the start of the transaction. This lets you do
several inserts having the same timestamp.

See here for details of timeofday() etc.
http://www.postgresql.org/docs/8.2/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashish Karalkar 2007-01-17 08:30:11 Cursor body?
Previous Message Albe Laurenz 2007-01-17 08:03:05 Re: Need help on SP