Re: possible time change issue - known problem? - Mailing list pgsql-general

From Dan Langille
Subject Re: possible time change issue - known problem?
Date
Msg-id 3E913C14.32033.A0BBF76@localhost
Whole thread Raw
In response to Re: possible time change issue - known problem?  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: possible time change issue - known problem?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 7 Apr 2003 at 22:43, Martijn van Oosterhout wrote:

> On Mon, Apr 07, 2003 at 08:19:57AM -0400, Dan Langille wrote:
> > Looking at the code, I suspect the problem is related to this problem
> > which I can duplicate on my current system: PostgreSQL 7.2.3 on i386-
> > portbld-freebsd4.6, compiled by GCC 2.95.4
> >
> > # select current_date, (current_date - interval '1 day')::date;
> >     date    |    date
> > ------------+------------
> >  2003-04-07 | 2003-04-05
> >
> > I expect the answer to be 2003-04-06 (i.e. yesterday's date).
>
> Out of curiosity, would this weekend be the day you switched to/from
> daylight savings time? Then there were only 23 hours in the day, so 1 day
> ago was actually the 5th.

Yes, as hinted in the message subject.  Hmmm, so that's how it's
doing the math.  I would think '24 hours' would give a different
answer to '1 day' since '1 day' is not necessarily == '24 hours'.

> Anyway, why not just:
>
> select current_date, current_date-1;
>     date    |  ?column?
> ------------+------------
>  2003-04-07 | 2003-04-06
> (1 row)

Nice.  Thanks.
--
Dan Langille : http://www.langille.org/


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: possible time change issue - known problem?
Next
From: "Dan Langille"
Date:
Subject: Re: Enum in PostgreSQL - How to