Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

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



"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



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group