From: | elein <elein(at)varlena(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org |
Cc: | elein(at)varlena(dot)com |
Subject: | Re: Are we backwards on the sign of timezones? |
Date: | 2003-07-03 19:56:43 |
Message-ID: | 200307031256.43801.elein@varlena.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
I think you are right about this. When people look up a
timezone, what we see is the offset to UTC.
UTC + (offset) should equal current time.
We should be consistent. And since the timestamp with
timezone is relatively recent, maybe it will not be so painful
to change the behaviour of extract() and date_part() to be
consistent with the display of timezones. I don't think that
many people do use extract or date part to fuss with the
timezone. But that is just my experience.
Anyone else who uses extract() and date_part() with timezones
should weigh in their opinions.
elein
On Thursday 03 July 2003 10:18, Tom Lane wrote:
> Currently, the extract(timezone_hour ...) and extract(timezone_minute
> ...) constructs (also the equivalent date_part() calls) return positive
> values for timezones west of Greenwich, and negative values for
> timezones east of Greenwich.
>
> While the SQL92 spec was quite vague on the subject of the signs of
> timezone displacements, SQL99 seems to be pretty clear that
>
> Local time is equal to UTC (Coordinated Universal Time) plus
> the time zone displacement,
>
> which would mean that positive displacements correspond to zones east of
> Greenwich. Another point in favor of this interpretation is that the
> spec defines the legal range of displacement as -12:59 to +13:00, which
> is clearly intended to accommodate New Zealand Daylight Time (13 hours
> ahead of UTC) ... so NZDT has to be a positive offset not a negative one.
>
> Interestingly, this is also the sign convention used by the timestamptz
> and timetz I/O routines, which are certainly much more heavily used than
> EXTRACT(). The only other place I can find that uses west-is-positive
> convention is the code for SET TIMEZONE with a direct numeric timezone
> offset.
>
> I think we got this wrong as a result of misreading SQL92, and we ought
> to change EXTRACT() and SET/SHOW TIMEZONE to use the same sign
> convention as timestamp input/display use.
>
> Comments? Can anyone confirm which sign is used by other DBMSes?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
>
--
=============================================================
elein(at)varlena(dot)com Database Consulting www.varlena.com
PostgreSQL General Bits http:/www.varlena.com/GeneralBits/
"Free your mind the rest will follow" -- en vogue
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno BAGUETTE | 2003-07-03 19:57:34 | Avoid the interpretation of \n in the psql output |
Previous Message | Tom Lane | 2003-07-03 19:56:36 | Re: problems with pg_restore to 7.3.3 db |
From | Date | Subject | |
---|---|---|---|
Next Message | Kurt Roeckx | 2003-07-03 20:43:55 | Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument |
Previous Message | scott.marlowe | 2003-07-03 19:56:08 | Re: [HACKERS] Are we backwards on the sign of timezones? |