Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[HACKERS] extract(timezone_hour) funny business

4 views
Skip to first unread message

Peter Eisentraut

unread,
Oct 10, 2001, 12:53:50 PM10/10/01
to
peter=# select current_timestamp;
timestamptz
-------------------------------
2001-10-10 01:04:54.965162+02
(1 row)

peter=# select extract(timezone_hour from current_timestamp);
date_part
-----------
-2
(1 row)

Plus or minus?

peter=# select extract(timezone_hour from timestamp '2001-10-10 01:04:54.965162+02');
date_part
-----------
-2
(1 row)

(Same problem)

peter=# select extract(timezone_hour from timestamp '2001-10-10 01:04:54.965162+03');
^^
date_part
-----------
-2
(1 row)

Big problem.

--
Peter Eisentraut pet...@gmx.net http://funkturm.homeip.net/~peter


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majo...@postgresql.org

Thomas Lockhart

unread,
Oct 11, 2001, 2:41:41 AM10/11/01
to
> Plus or minus?

Is there a standard for this? We are printing date/time using Posix
conventions, which are opposite from the SQL conventions for setting
time zone (which we don't yet support, since it is fundamentally useless
;) I apparently implemented one, and you expect the other.

> peter=# select extract(timezone_hour from timestamp '2001-10-10 01:04:54.965162+03');

> -----------
> -2
> Big problem.

Not really. The timestamp you have specified is read in and internalized
as a gmt value, then is rewritten using your current time zone settings.
afaict the time zone on an input value should not persist with the value
itself, so the info does not carry far enough forward to be used for an
output routine.

Note that I did not implement "time with time zone" this way, but rather
used a "persistant time zone". I *think* that this should be taken out,
but further discussion is welcome. The reference books are distressingly
unclear or obviously incorrect on this topic, presumably in the
interests of remaining lucid.

- Thomas

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

0 new messages