Timezone Inconsistancies

From: "Arguile" <arguile(at)lucentstudios(dot)com>
To: "PostgreSQL Hackers List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Timezone Inconsistancies
Date: 2002-02-26 03:11:02
Message-ID: LLENKEMIODLDJNHBEFBOKEBJEEAA.arguile@lucentstudios.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Couldn't find these particular inconsistancy in the archives. If this has
already appeared, sorry.

1) Casting with and without timezones:

=# SELECT time 'now';
now
------------------
21:31:33.9210-08
(1 row)

Works.

=# SELECT CURRENT_TIME::time;
now
------------------
21:31:33.9210-08
(1 row)

Same.

=# SELECT now()::time;
ERROR: Cannot cast type 'timestamp with time zone' to
'time without time zone'

Hrmm... Inconsistant

=# SELECT now()::timetz;
now
------------------
21:31:33.9210-08
(1 row)

That of course works.

SELECT now()::date;
now
------------
2002-02-25
(1 row)

Again works.

I understand why it's not implicitly casting, but if tz can be ignored in
one it should exhibit the same behavoir for all.

2) Another inconsistancy is timestamp default to having a timezone, while
time does not, and dates not even having a date with timezone option:

::time != ::timetz
::timestamp == ::timestamptz
::date ??

Dates are just as effected by time zones as time is. The only way to cast to
timestamp without tz is CAST( ... without time zone) as far as I can tell;
as ::timestamp(p) doesn't work nor the w/ w/o tz in that style of casting.

Among other fun new timestamp changes ;)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-02-26 03:22:55 Re: More time zones
Previous Message Peter Eisentraut 2002-02-26 03:04:52 Re: More time zones