Skip site navigation (1) Skip section navigation (2)

Re: Timezone database questions

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>,"PostgreSQL-interfaces" <pgsql-interfaces(at)postgresql(dot)org>,"PostgreSQL Win32 port list" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: Timezone database questions
Date: 2004-05-02 18:07:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-hackers-win32pgsql-interfaces
>> >1)  How do we set the default local timezone for our 
>database?  The OS
>> >knows the local timezone.  How do we set our local timezone 
>on Win32? 
>> >On Unix?  (On Unix, there is usually an /etc/localtime file that is
>> >created during install.)  Perhaps we can query the current timezone
>> >specification (e.g. EDT), and do some kind of lookup.  I 
>know of no way
>> >to get the full specification, e.g. EST5EDT or America/New_York.
>> Could we just require that it is configured through postgresql.conf?
>> IIRC there is a parameter to set it there. IMO, that would be enough.
>We would get too many problem reports we would get if we always
>defaulted the database timezone to GMT.  We have to set the default,
>perhaps during initdb.  (I just posted something else explaining why we
>should have initdb set sharedir and libdir too.)

Set the defualt timezone at initdb sounds a bit weird. Again, timezone
stuff is only used to present data, not to change it. You can even
change it during a transaction. Setting the default at inidb seems
weird. If you want to set the default, use postgresql.conf. Otherwise,
we need to pick it up somewhere else.

>> If not, we can use GetTimeZoneInformation(). It returns the standard
>> name (amongst other things) of the tz configured in the system.
>Yep, we will need that, and for Unix too.

Can't tell you how to do it on Unix :-(

>> Or do nothing. On unix it defaults to the value of the TZ environment
>> variables. If you set that one before you start it, you get the same
>> behaviour. In that case, I'd still say we *recommend* setting it in
>> postgresql.conf, but it will still work.
>Right now I think it defaults to the OS timezone if you don't 
>set PGTZ. 
>We can't require everyone to set PGTZ to get a reasonable default

Note - TZ, not PGTZ. At least it says so in the postgresql.conf that is
installed. So it's at least a standard env variable, and not a PG only
one. I don't know how often this one is actually set, though.



pgsql-hackers by date

Next:From: Michael MeskesDate: 2004-05-02 18:08:53
Subject: Re: [HACKERS] ecpg and the timezone database
Previous:From: Ted KremenekDate: 2004-05-02 18:05:38
Subject: [CHECKER] 4 memory leaks in Postgresql 7.4.2

pgsql-interfaces by date

Next:From: Michael MeskesDate: 2004-05-02 18:08:53
Subject: Re: [HACKERS] ecpg and the timezone database
Previous:From: Bruce MomjianDate: 2004-05-02 12:07:53
Subject: Re: Timezone database questions

pgsql-hackers-win32 by date

Next:From: Bruce MomjianDate: 2004-05-02 18:16:40
Subject: Re: Timezone database questions
Previous:From: Andrew DunstanDate: 2004-05-02 17:52:57
Subject: Re: win32 build and test issues

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group