Re: TIME ZONE SQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Raman Garg" <ramang(at)smartdatainc(dot)com>
Cc: "Richard Huxton" <dev(at)archonet(dot)com>, "pgsql-sql" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: TIME ZONE SQL
Date: 2004-02-05 16:54:15
Message-ID: 3968.1076000055@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Raman Garg" <ramang(at)smartdatainc(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Anderson 2004-02-05 23:04:28 Could not convert UTF-8 to ISO8859-1
Previous Message Richard Huxton 2004-02-05 16:31:06 Re: TIME ZONE SQL