Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 04554633197 for ; Fri, 20 Mar 2009 20:56:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 18533-08 for ; Fri, 20 Mar 2009 20:56:19 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx.astrofoto.org (mx.astrofoto.org [216.254.78.156]) by mail.postgresql.org (Postfix) with ESMTP id 3DA59632DE8 for ; Fri, 20 Mar 2009 20:56:26 -0300 (ADT) Message-ID: <49C42D22.2010101@astrofoto.org> Date: Fri, 20 Mar 2009 19:56:18 -0400 From: Roland Roberts User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org References: <49C3C5FB.20706@astrofoto.org> <49C4150B.8060902@opencloud.com> <49C42855.3050608@astrofoto.org> <49C42912.1010807@opencloud.com> In-Reply-To: <49C42912.1010807@opencloud.com> Subject: Re: Hibernate, JBoss, PostgreSQL, timestamp read doesn't match during update Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.2 (built Tue, 02 May 2006 07:36:10 -0400) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/103 X-Sequence-Number: 19433 Oliver Jowett wrote: > Roland Roberts wrote: > >> Oliver Jowett wrote: >> >>> Roland Roberts wrote: >>> >>> >>>> Yes, restrict the timestamp to millisecond precision. Somewhere the >>>> sub-millisecond parts are getting lost. I have no idea if it is in the >>>> JDBC layer or somewhere in Hibernate. Any clues on figuring this out? >>>> >>> Is the server built with integer_datetimes? Maybe you are just hitting a >>> rounding problem. >>> >> Which server; do you mean PostgreSQL or JBoss? I think you mean JBoss, >> but I'm not sure how to check on that. If you know, please share. I'll >> see what I can find out. >> > No, I mean the PostgreSQL server. > roland=# show integer_datetimes; integer_datetimes ------------------- off (1 row) When I use a trigger to set the timestamps, they show up with microsecond precision. The problem is that the extra precision is definitely getting lost before Hibernate tries to put the value back. The update looks more-or-less like update mytable set col1=val1 where primary_key = pkval and some_timestamp = timestamp_value timestamp_value doesn't match what is in the database even though it was retrieved by an earlier query. I've got some more poking I can do. Java doesn't seem to have a way of printing microseconds for timestamps with, for example, SimpleDateFormat, but I should be able to see if it can at least retrieve them. roland -- PGP Key ID: 66 BC 3B CD Roland B. Roberts, PhD RL Enterprises roland@rlenter.com 6818 Madeline Court roland@astrofoto.org Brooklyn, NY 11220