Re: BUG #3586: Time zone problem in SQL query - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #3586: Time zone problem in SQL query
Date
Msg-id 12062.1188426633@sss.pgh.pa.us
Whole thread Raw
In response to BUG #3586: Time zone problem in SQL query  ("George Wright" <george.wright@infimatic.com>)
List pgsql-bugs
"George Wright" <george.wright@infimatic.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

pgsql-bugs by date:

Previous
From: Cyrus Downey
Date:
Subject: Re: BUG #3587: EXECUTE and trigger problem [VASCL:A163D284A86]
Next
From: "Richard Harris"
Date:
Subject: BUG #3588: coalesce not working in join