Обсуждение: Re: postgres time zone settings(time difference in Server and client)

Поиск
Список
Период
Сортировка

Re: postgres time zone settings(time difference in Server and client)

От
"Anoop G"
Дата:

Hai all,

   I have  database running on server. I am using python to run my application.postgres client is running on the clients .All clients are connected to a single database running on server. Each time application starts ,the login time is taken from server  using the query
"""select CAST ( timeofday() AS timestamp"""

But the problem the time which I got is different from that of server machine . I Think the postgres client is adding some values to the server time. How can I solve this .Is there any configuration setting for client to solve this?.In which location client's configuration file is stored( I am using Linux(Debian )?.

here the result I got:

The correct time in server:   2008-07-25 14:16:54

But What i got from client (with database cursor of sever database): 
   2008-07-25 19:46:33.46  (difference of more than 5 Hr ) Where this difference come?

any one know the answer pls help me.

Thanks in advance

Anoop



Re: postgres time zone settings(time difference in Server and client)

От
Richard Huxton
Дата:
Anoop G wrote:
> Hai all,
> 
>    I have  database running on server. I am using python to run my
> application.postgres client is running on the clients .All clients are
> connected to a single database running on server. Each time application
> starts ,the login time is taken from server  using the query
> """select CAST ( timeofday() AS timestamp"""
> 
> But the problem the time which I got is different from that of server
> machine . I Think the postgres client is adding some values to the server
> time. How can I solve this .Is there any configuration setting for client to
> solve this?.In which location client's configuration file is stored( I am
> using Linux(Debian )?.

1. If you have a recent version of PostgreSQL use clock_timestamp()
2. Why are you using timestamp without timezone?

SELECT clock_timestamp();        clock_timestamp
-------------------------------- 25/07/2008 10:21:58.464055 BST

SET timezone='EST';

SELECT clock_timestamp();        clock_timestamp
-------------------------------- 25/07/2008 04:22:19.584367 EST

--   Richard Huxton  Archonet Ltd


Re: postgres time zone settings(time difference in Server and client)

От
"Pawel Socha"
Дата:
2008/7/25 Anoop G <anoopmadavoor@gmail.com>:

Hai all,

   I have  database running on server. I am using python to run my application.postgres client is running on the clients .All clients are connected to a single database running on server. Each time application starts ,the login time is taken from server  using the query
"""select CAST ( timeofday() AS timestamp"""

But the problem the time which I got is different from that of server machine . I Think the postgres client is adding some values to the server time. How can I solve this .Is there any configuration setting for client to solve this?.In which location client's configuration file is stored( I am using Linux(Debian )?.

here the result I got:

The correct time in server:   2008-07-25 14:16:54

But What i got from client (with database cursor of sever database): 
   2008-07-25 19:46:33.46  (difference of more than 5 Hr ) Where this difference come?

any one know the answer pls help me.

Thanks in advance

Anoop




server localtime is correct ?
/etc/localtime ...

--
--
Serdecznie pozdrawiam

Pawel Socha
pawel.socha@gmail.com

programista/administrator

perl -le 's**02).4^&-%2,).^9%4^!./4(%2^3,!#+7!2%^53%2&**y%& -;^[%"`-{ a%%s%%$_%ee'

Re: postgres time zone settings(time difference in Server and client)

От
"Anoop G"
Дата:
Hai all,

my postgres version is PostgreSQL 8.1.8  didn't support  clock_timestamp()

regards:

Anoop