pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Raman Garg <ramang@smartdatainc.com>
Cc: Richard Huxton <dev@archonet.com>
Cc: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: TIME ZONE SQL
Date: Thu, 05 Feb 2004 11:54:15 -0500
Message-ID: <3968.1076000055@sss.pgh.pa.us> (raw)
In-Reply-To: <00e001c3ebf8$bd6efc50$d4c7a8c0@raman>
References: <JEEKIPNAKJNCFLMOBKHGOEDKDCAA.email@juergen-cappel.de>
	<200402042003.07189.dev@archonet.com>
	<006101c3ebc2$134c0dc0$d4c7a8c0@raman>
	<200402051100.58825.dev@archonet.com>
	<00e001c3ebf8$bd6efc50$d4c7a8c0@raman>

"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



view thread (7+ messages)

Message-ID: <3968.1076000055@sss.pgh.pa.us>
Permalink:  ../3968.1076000055@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3968.1076000055@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ramang@smartdatainc.com, dev@archonet.com
  Subject: Re: TIME ZONE SQL
  In-Reply-To: <3968.1076000055@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox