Re: Behavior of "at time zone"

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Andrew Crouch <andrew(dot)crouch(at)ericsson(dot)com>
Subject: Re: Behavior of "at time zone"
Date: 2010-01-29 13:56:59
Message-ID: 201001290557.00666.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday 29 January 2010 5:34:04 am Andrew Crouch wrote:
> Hi there,
> I'm looking to use the "at time zone" language feature, however
> the results below don't really agree with my expectations. Is this a bug
> in 8.4 or am I misinterpreting the results? If it is a bug, has it been
> fixed in the development releases?
>
>
> psql (8.4.0)
> Type "help" for help.
>
> ispdb_br=> set timezone to '-2';
> SET
> ispdb_br=> select now();
> now
> -------------------------------
> 2010-01-29 11:26:22.833697-02
> (1 row)
>
> ispdb_br=> select now() at time zone 'BRST';
> timezone
> ----------------------------
> 2010-01-29 11:26:30.521964
> (1 row)
>
> ispdb_br=> select now() at time zone '-2';
> timezone
> ----------------------------
> 2010-01-29 15:26:47.010222
> (1 row)
>
> ispdb_br=> select now() at time zone '+2';
> timezone
> ---------------------------
> 2010-01-29 11:26:49.55412
> (1 row)

From here:
http://www.postgresql.org/docs/8.4/interactive/datatype-datetime.html#DATATYPE-TIMEZONES

"One should be wary that the POSIX-style time zone feature can lead to silently
accepting bogus input, since there is no check on the reasonableness of the
zone abbreviations. For example, SET TIMEZONE TO FOOBAR0 will work, leaving the
system effectively using a rather peculiar abbreviation for UTC. Another issue
to keep in mind is that in POSIX time zone names, positive offsets are used for
locations west of Greenwich. Everywhere else, PostgreSQL follows the ISO-8601
convention that positive timezone offsets are east of Greenwich. "

>
>
> Regards,
> Andrew

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2010-01-29 14:40:38 Versions RSS page is missing version(s)
Previous Message Dave Page 2010-01-29 13:36:16 Re: ODBC mac os