Discussion:
Forcing postgres to reload current time zone.
(too old to reply)
t***@cotse.net
2004-07-01 13:48:33 UTC
Permalink
Hello,

I'm writing an application that issues "SELECT current_timestamp" from
postgres on a regular basis to get the time. However, the user may
change the system's time zone and postgres does not seem to reflect this
change unless I restart the database daemon. I cannot have all of my
program threads issue a SET TIME ZONE query, and was hoping there is a
query I could issue that would globally update the time zone for all
currently running postgres sessions, or a more gentle way to force
postgres to reload its time zone information without completely
restarting the daemon. Any advice?

I've done quite a bit of searching for this answer and I'm not coming up
with anything useful. I'm running postgres on RedHat Linux 9.

Many thanks,

trena
Tom Lane
2004-07-10 04:25:01 UTC
Permalink
Post by t***@cotse.net
I'm writing an application that issues "SELECT current_timestamp" from
postgres on a regular basis to get the time. However, the user may
change the system's time zone and postgres does not seem to reflect this
change unless I restart the database daemon. I cannot have all of my
program threads issue a SET TIME ZONE query, and was hoping there is a
query I could issue that would globally update the time zone for all
currently running postgres sessions, or a more gentle way to force
postgres to reload its time zone information without completely
restarting the daemon. Any advice?
Readjust your objectives? AFAIK every other daemon in your system will
behave the same way.

You could force Postgres into a new timezone by adjusting the timezone
setting in postgresql.conf and SIGHUP'ing the postmaster. But it hardly
seems reasonable to build a mechanism to make that happen whenever the
user hacks on the system-wide timezone setting (especially considering
what a wide variety of means there are in different Unixen for defining
what the "system-wide timezone" is).

Note also that the timezone is hardly the only setting which your user
will have trouble changing on-the-fly --- locale and IP address come to
mind, and I'm sure there are others. Again, Postgres is not the only
daemon that is not designed to recognize such changes instantly.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ***@postgresql.org)
Loading...