Timezone fun (bugs and a request)

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Timezone fun (bugs and a request)
Date: 2004-05-23 19:51:58
Message-ID: 20040523195158.GB15995@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm looking at the new timezone support.

First I initdb'd without TZ set. So every time I start the server I get

LOG: could not recognize system timezone, defaulting to "Etc/GMT-4"
HINT: You can specify the correct timezone in postgresql.conf.

Obviously the setup is wrong because DST doesn't work:

alvherre=# select '2004-03-13 10:00:00'::timetz;
timetz
-------------
10:00:00+04
(1 fila)

alvherre=# select '2004-03-14 10:00:00'::timetz;
timetz
-------------
10:00:00+04
(1 fila)

alvherre=# set TimeZone to 'Chile/Continental';
SET
alvherre=# select '2004-03-13 10:00:00'::timetz;
timetz
-------------
10:00:00-03
(1 fila)

alvherre=# select '2004-03-14 10:00:00'::timetz;
timetz
-------------
10:00:00-04
(1 fila)

Note I get +4 on the default zone and -4 on the correct zone. I think
this is a bug.

So I went and set it in postgresql.conf,
timezone = 'Chile/Continental'

After this, DST works correctly, but I continue to receive the LOG
message above. I think it should be supressed.

I then changed postgresql.conf to read

timezone = unknown
(the difference with the original setting is that the line isn't
commented).

The server now behaves different; the timezone is set to GMT rather than
being guessed from system settings. I think they should work the same.

I also want to be able to specify a non-default timezone and get a time
with the correct displacement. CLT is abbreviation for
Chile/Continental, and CLST is the summer timezone.

alvherre=# select '10:00:00'::time at time zone 'CLT';
timezone
-------------
10:00:00-04
(1 fila)

alvherre=# select '10:00:00'::time at time zone 'CLST';
timezone
-------------
11:00:00-03
(1 fila)

alvherre=# select '10:00:00'::time at time zone 'Chile/Continental';
ERROR: el huso horario "chile/continental" no es reconocido

I would like to get the time in the corresponding zone, without me
having to know in advance whether I'm in current DST or not. Is this
possible? For example I want to know what's the current time in
'Europe/Madrid'.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Puedes vivir solo una vez, pero si lo haces bien, una vez es suficiente"

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-05-23 20:39:37 Re: Fixing the Turkish problem
Previous Message Ziga Kranjec 2004-05-23 19:40:56 Re: eval function