Re: Inconsistent behavior with TIMESTAMP WITHOUT and epoch

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Inconsistent behavior with TIMESTAMP WITHOUT and epoch
Date: 2005-01-27 18:54:29
Message-ID: 22819.1106852069@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Josh Berkus <josh(at)agliodbs(dot)com> writes:
> The problem with the current functionality is that it makes it impossible to
> get a GMT Unix timestamp out of a TIMESTAMP WITHOUT TIME ZONE without string
> manipulation.

How so? If you think that the timestamp-without-zone is relative to GMT
rather than your local zone, you say something like
extract(epoch from (timestampvar AT TIME ZONE 'GMT'))

> And for an application where you want the timestamps to be
> location-agnostic (such as this one, with servers on east and west coasts,
> and some talk about London), you want your timestamps stored as GMT.

Quite honestly, you should be using timestamp WITH time zone for such an
application anyway. The timestamp without zone datatype is very
strongly biased towards the assumption that the value is in your local
timezone, and if you've actually got multiple possible settings of
TimeZone then it's simply a great way to shoot yourself in the foot.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tamas Vincze 2005-01-27 19:08:36 Re: 8.0.0 make check fails on Solaris 9 (sparc)
Previous Message PFC 2005-01-27 18:24:37 Re: [GENERAL] My postmaster just crashed !