Обсуждение: How to set time zone permanently
How do you set the time zone permanently in postgresql? I can use the set time zone 'EST' in psql on template1 show time zone & it shows EST exit then go back into psql & do a show time zone & it says time zone unknown Where do I & how do I permanently set the time zone? thanks Pam Wamper
Pam Wampler <Pam_Wampler@taylorwhite.com> writes: > Where do I & how do I permanently set the time zone? I think best/only way right now is to set the TZ environment variable before starting the postmaster. The TimeZone variable ought to be settable from postgresql.conf, but for some reason it's not there now. BTW, if the system default timezone is not already the way you want it, you might consider making it so rather than putting a special hack into the Postgres start script. This usually involves creating or changing a configuration file somewhere under /etc ... regards, tom lane
Thanks Tom That worked !!! I added /etc/TIMEZONE & put TZ=EST export TZ in that file then in /etc/profile I added #prw added 2/20/2002 for timezone # Set the TIMEZONE if [ -r /etc/TIMEZONE ] then . /etc/TIMEZONE then logged out as postgres user & back in & stopped & restarted using pg_ctl and did show time zone & it said EST thanks & thanks to this wonderful messaging -- you guys are terrific to help out like this Pam -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Wednesday, February 20, 2002 10:40 AM To: Pam Wampler Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] How to set time zone permanently Pam Wampler <Pam_Wampler@taylorwhite.com> writes: > Where do I & how do I permanently set the time zone? I think best/only way right now is to set the TZ environment variable before starting the postmaster. The TimeZone variable ought to be settable from postgresql.conf, but for some reason it's not there now. BTW, if the system default timezone is not already the way you want it, you might consider making it so rather than putting a special hack into the Postgres start script. This usually involves creating or changing a configuration file somewhere under /etc ... regards, tom lane
Tom Lane wrote: > Pam Wampler <Pam_Wampler@taylorwhite.com> writes: > > Where do I & how do I permanently set the time zone? > > I think best/only way right now is to set the TZ environment variable > before starting the postmaster. The TimeZone variable ought to be > settable from postgresql.conf, but for some reason it's not there now. > > BTW, if the system default timezone is not already the way you want it, > you might consider making it so rather than putting a special hack into > the Postgres start script. This usually involves creating or changing > a configuration file somewhere under /etc ... Actually, I think there are three levels: system timezone, TZ, and PGTZ environment variables. The first is all processes, the second is all processes that have TZ set, and PGTZ affects only PostgreSQL and not other applications. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian wrote: > Actually, I think there are three levels: system timezone, > TZ, and PGTZ environment variables. The first is all processes, the second is all > processes that have TZ set, and PGTZ affects only PostgreSQL and not > other applications. But, as far as I can see, these variables are taken into account at client level. I.e. I have to set PGTZ=WST for the users who are running the clients, not as the postgres user who runs the server (I have at least not managed that, I have tried to set the variables in the pg startup script and in the .profile of the postgres user to no avail). When I am running windows clients, (ipgsql and a couple of things I have written in Delphi) they don't seem to care about the time zone. Is it any way I can tell the pgodbc driver or the pglibs on Windows pcs which time zone to use when connecting to the server? best regards -- Morten Sickel Norwegian Radiation Protection Authority