Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

Next:From: Tom LaneDate: 2002-02-26 03:22:55
Subject: Re: More time zones
Previous:From: Peter EisentrautDate: 2002-02-26 03:04:52
Subject: Re: More time zones

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group