Re: Curious Win32 timestamp shift

Karsten Hilbert <[email protected]> Wed, 27 Jun 2007 13:30:20 +0200
Newsgroups gmane.comp.python.db.pypgsql.user
Message-ID <[email protected]>
On Thu, Jun 21, 2007 at 02:46:32PM +1000, Kingsley wrote:

> I'm using PyPgSQL against a table that has a 'timestamp' type
> field.  Under Linux I have no problems, but when results are
> returned from the database under win32, they are shifted by +10 hours
> (This is also happens to be my timezone.)  I have not applied a
> timezone to the timestamp-type field.  Interestingly, they are
> being stored correctly, just not retrieved properly.
> 
> The times in the database are indeed stored in UTC, but PyPgSQL doesn't 
> know this ;)

You may just be lucky to retrieve "proper" values under
Linux. In any case you'll have to tell PG which timezone the
client is running under or else the default server timezone
is used to return timestamps in - which may happen to work
with Linux but not Windows.

So, use "set client timezone to ..." somewhere appropriate
in your connection setup.

Or else always retrieve timestamps with the "AT timezone" syntax.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/