Thread: Problem with Mauritius summer time (MUST)

Problem with Mauritius summer time (MUST)

From
Xavier Bugaud
Date:
Hi,

Mauritius use daylight saving since 2008-11.
The Olson database has been updated to reflect the Mauritius timezone change
at the end of 2008 (maybe since tzdata-2008f or tzdata-2008g, not really
sure).

Postgresql is supposed to have the correct Mauritius timezone since 8.3.5
(http://www.postgresql.org/docs/8.3/interactive/release-8-3-5.html).

From a debian box configured in the Mauritius timezone :
$ date
Wed Mar  4 11:10:01 MUST 2009
$ psql -c "SELECT '2009-01-01 00:56:00 MUT'::timestamp"
      timestamp
---------------------
 2009-01-01 00:56:00
(1 row)

$ psql -c "SELECT '2009-01-01 00:56:00 MUST'::timestamp"
ERROR:  invalid input syntax for type timestamp: "2009-01-01 00:56:00 MUST"

As you can see Posgresql does not recognize the "MUST" (Mauritius Summer
Time).

For reference, here is the content of the tzdata file related to Mauritius :

# Rule    NAME    FROM    TO    TYPE    IN    ON    AT    SAVE    LETTER/S
Rule Mauritius    1982    only    -    Oct    10    0:00    1:00    S
Rule Mauritius    1983    only    -    Mar    21    0:00    0    -
Rule Mauritius    2008    max    -    Oct    lastSun    2:00s    1:00    S
Rule Mauritius    2009    max    -    Mar    lastSun    2:00s    0    -
# Zone    NAME        GMTOFF    RULES    FORMAT    [UNTIL]
Zone Indian/Mauritius    3:50:00 -    LMT    1907        # Port Louis
            4:00 Mauritius    MU%sT    # Mauritius Time

Is this a bug in Posgresql or am I missing something ?
This problem was encountered with Postgresql 8.3.5 and 8.3.6.

Regards.
--
Xavier Bugaud

Re: Problem with Mauritius summer time (MUST)

From
Peter Eisentraut
Date:
Xavier Bugaud wrote:
> Postgresql is supposed to have the correct Mauritius timezone since 8.3.5
> (http://www.postgresql.org/docs/8.3/interactive/release-8-3-5.html).
>
> From a debian box configured in the Mauritius timezone :

PostgreSQL on Debian uses the operating system's time zone database.  So
check that your tzdata package is the version you want.

dpkg -l tzdata


Re: Problem with Mauritius summer time (MUST)

From
Xavier Bugaud
Date:
On Wednesday 04 March 2009 15:04:56 Peter Eisentraut wrote:
> Xavier Bugaud wrote:
> > Postgresql is supposed to have the correct Mauritius timezone since 8.3.5
> > (http://www.postgresql.org/docs/8.3/interactive/release-8-3-5.html).
> >
> > From a debian box configured in the Mauritius timezone :
>
> PostgreSQL on Debian uses the operating system's time zone database.  So
> check that your tzdata package is the version you want.
>
> dpkg -l tzdata

The time zone database was already the latest (2009b) so the problem is
elsewhere...

--
Xavier Bugaud

Re: Problem with Mauritius summer time (MUST)

From
Gregory Stark
Date:
Xavier Bugaud <xavier.bugaud@gloptv.com> writes:

> Hi,
>
> Mauritius use daylight saving since 2008-11.
> The Olson database has been updated to reflect the Mauritius timezone change
> at the end of 2008 (maybe since tzdata-2008f or tzdata-2008g, not really
> sure).
>
> Postgresql is supposed to have the correct Mauritius timezone since 8.3.5
> (http://www.postgresql.org/docs/8.3/interactive/release-8-3-5.html).
>
> From a debian box configured in the Mauritius timezone :
> $ date
> Wed Mar  4 11:10:01 MUST 2009
> $ psql -c "SELECT '2009-01-01 00:56:00 MUT'::timestamp"
>       timestamp
> ---------------------
>  2009-01-01 00:56:00
> (1 row)
>
> $ psql -c "SELECT '2009-01-01 00:56:00 MUST'::timestamp"
> ERROR:  invalid input syntax for type timestamp: "2009-01-01 00:56:00 MUST"
>
> As you can see Posgresql does not recognize the "MUST" (Mauritius Summer
> Time).
>
> For reference, here is the content of the tzdata file related to Mauritius :
>
> # Rule    NAME    FROM    TO    TYPE    IN    ON    AT    SAVE    LETTER/S
> Rule Mauritius    1982    only    -    Oct    10    0:00    1:00    S
> Rule Mauritius    1983    only    -    Mar    21    0:00    0    -
> Rule Mauritius    2008    max    -    Oct    lastSun    2:00s    1:00    S
> Rule Mauritius    2009    max    -    Mar    lastSun    2:00s    0    -
> # Zone    NAME        GMTOFF    RULES    FORMAT    [UNTIL]
> Zone Indian/Mauritius    3:50:00 -    LMT    1907        # Port Louis
>             4:00 Mauritius    MU%sT    # Mauritius Time
>
> Is this a bug in Posgresql or am I missing something ?
> This problem was encountered with Postgresql 8.3.5 and 8.3.6.

Hm, you can use Indian/Mauritius to reference the appropriate time zone
directly but that doesn't let you specify Mauritius Summer Time explicitly.

I think the problem is that MUST is missing from the Default
timezone_abbreviations file.

SELECT '2009-01-01 00:56:00 Indian/Mauritius'::timestamp with time zone;
      timestamptz
------------------------
 2008-12-31 19:56:00+00

--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

Re: Problem with Mauritius summer time (MUST)

From
Xavier Bugaud
Date:
On Wednesday 04 March 2009 16:32:27 Gregory Stark wrote:
> Xavier Bugaud <xavier.bugaud@gloptv.com> writes:
> >
> > $ psql -c "SELECT '2009-01-01 00:56:00 MUST'::timestamp"
> > ERROR:  invalid input syntax for type timestamp: "2009-01-01 00:56:00
> > MUST"
>
> I think the problem is that MUST is missing from the Default
> timezone_abbreviations file.

Gregory you're right : it works after adding MUST in timezone/tznames/Default.

I will propose a patch in pgsql-hackers.

Thanks.
--
Xavier Bugaud