Re: possible time change issue - known problem?

From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dan Langille <dan(at)langille(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: possible time change issue - known problem?
Date: 2003-04-07 19:42:56
Message-ID: 20030407204256.B29873@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 07, 2003 at 12:05:13PM -0400, Tom Lane wrote:
> "Dan Langille" <dan(at)langille(dot)org> writes:
> > OK, I'll say again. The problem was not present on my 7.3.2 box but
> > was on the 7.2.3 box.
>
> Oh, I see: you're not testing the right thing. In 7.3, 'date - interval'
> promotes to 'timestamp without time zone - interval':
>
> regression=# select current_date, (current_date - interval '24 hours');
> date | ?column?
> ------------+---------------------
> 2003-04-07 | 2003-04-06 00:00:00
> (1 row)
>
> which is a crude but effective way of sidestepping the issue. But if
> you do the same calculation 7.2 did:
>
> regression=# select current_date, (current_date::timestamptz - interval '24 hours');
> date | ?column?
> ------------+------------------------
> 2003-04-07 | 2003-04-05 23:00:00-05
> (1 row)
>
> you'll still get the same unwanted result.

In case this is related, I get the following regression.diffs with today's cvs:

*** ./expected/horology.out Mon Apr 7 16:56:14 2003
--- ./results/horology.out Mon Apr 7 20:21:10 2003
***************
*** 571,577 ****
SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True";
True
------
! t
(1 row)

SELECT (timestamp with time zone 'today' = (timestamp with time zone 'tomorrow' - interval '1 day')) as "True";
--- 571,577 ----
SELECT (timestamp with time zone 'today' = (timestamp with time zone 'yesterday' + interval '1 day')) as "True";
True
------
! f
(1 row)

SELECT (timestamp with time zone 'today' = (timestamp with time zone 'tomorrow' - interval '1 day')) as "True";
***************
*** 583,589 ****
SELECT (timestamp with time zone 'tomorrow' = (timestamp with time zone 'yesterday' + interval '2 days')) as "True";
True
------
! t
(1 row)

SELECT (timestamp with time zone 'tomorrow' > 'now') as "True";
--- 583,589 ----
SELECT (timestamp with time zone 'tomorrow' = (timestamp with time zone 'yesterday' + interval '2 days')) as "True";
True
------
! f
(1 row)

SELECT (timestamp with time zone 'tomorrow' > 'now') as "True";

======================================================================

Cheers,

Patrick
(NetBSD-1.6Q/i386 gcc 2.95.3nb4)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Holger Marzen 2003-04-07 20:25:15 Why no performance boost although I added an index?
Previous Message nolan 2003-04-07 18:35:15 Age function