Re: Bug #651: Time difference of 30 in while reading in timestamp - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #651: Time difference of 30 in while reading in timestamp
Date
Msg-id 20005.1020176952@sss.pgh.pa.us
Whole thread Raw
In response to Bug #651: Time difference of 30 in while reading in timestamp  (pgsql-bugs@postgresql.org)
Responses Re: Bug #651: Time difference of 30 in while reading in timestamp  (R Ravishankar <rravishankar@sify.com>)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
> I am using Java 1.3.1 and Postgres 7.1.2 and am writing timestamp without zone info to the database using JDBC (my
zoneis IST or +5:30GMT). I find that there is always a time difference of 30 minutes when i read from the database. 

> When i query the postgres database from the SQL prompt, the time is as i had written it. But when i read it from the
databaseinto my java code it is more exactly by 30 mins. 

I assume the datatype of the table column is "timestamp"?  The internal
storage is in GMT, which is converted to the timezone specified by your
current TimeZone setting whenever you SELECT the value.  If it works in
psql then the database side of things seems to be okay.  I suspect that
in the JDBC case, the backend's TimeZone variable is being set to
something different than what you think it is (either +5 or +6, not
5:30).  Can you try a "SET TimeZone" to set the zone explicitly within
your JDBC program, and see whether the results change?

            regards, tom lane

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #651: Time difference of 30 in while reading in timestamp
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: Bug #652: NAMEDATALEN limitations