Re: TIME ZONE SQL - Mailing list pgsql-sql

From Tom Lane
Subject Re: TIME ZONE SQL
Date
Msg-id 3968.1076000055@sss.pgh.pa.us
Whole thread Raw
In response to Re: TIME ZONE SQL  ("Raman Garg" <ramang@smartdatainc.com>)
List pgsql-sql
"Raman Garg" <ramang@smartdatainc.com> writes:
> Actually my "between" is creating some problems and is not giving me results
> so what I have done is . IN MY WHERE CLAUSE OF QUERY:

I suspect that this revised clause will give you problems too, namely
selecting rows you don't want.

I think what may actually be happening here is that you have times
wrapping around past midnight.  For instance consider

regression=# select '10:30'::time + '15 hours'::interval;?column?
----------01:30:00
(1 row)

regression=# select '10:30'::time - '15 hours'::interval;?column?
----------19:30:00
(1 row)

It seems to me that your approach to the problem is all wrong, and you
need to be using timestamp-based calculations not time-of-day-based
calculations.
        regards, tom lane


pgsql-sql by date:

Previous
From: Richard Huxton
Date:
Subject: Re: TIME ZONE SQL
Next
From: Chris Anderson
Date:
Subject: Could not convert UTF-8 to ISO8859-1