Re: BUG #3586: Time zone problem in SQL query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "George Wright" <george(dot)wright(at)infimatic(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3586: Time zone problem in SQL query
Date: 2007-08-29 22:30:33
Message-ID: 12062.1188426633@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"George Wright" <george(dot)wright(at)infimatic(dot)com> writes:
> badger=> select logid, starttime from tz where starttime BETWEEN '2007-01-22
> 02:30:00-03' and '2007-01-23 03:00:00-03';
> logid | starttime
> -------+------------------------
> 1 | 2007-01-22 23:00:00-06 <- is this right?

Why not? 2007-01-22 02:30:00-03 equates to 2007-01-21 23:30:00-06,
so it's before that time, and 2007-01-23 03:00:00-03 equates to
2007-01-23 00:00:00-06, so it's after.

> badger=> select logid, starttime from tz where starttime BETWEEN '2007-01-22
> 00:30:00-05' and '2007-01-23 01:00:00-05';
> badger=> select logid, starttime from tz where starttime BETWEEN '2007-01-22
> 23:30:00-06' and '2007-01-23 00:00:00-06';

Notice you forgot to adjust the date in the first value here, so these
are not equivalent boundary times.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Richard Harris 2007-08-29 22:58:06 BUG #3588: coalesce not working in join
Previous Message Cyrus Downey 2007-08-29 22:08:05 Re: BUG #3587: EXECUTE and trigger problem [VASCL:A163D284A86]