X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C43AFD1D82E for ; Thu, 5 Feb 2004 16:31:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 64779-04 for ; Thu, 5 Feb 2004 12:31:17 -0400 (AST) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id EBEB2D1D516 for ; Thu, 5 Feb 2004 12:31:13 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 1AomPG-00077V-0X; Thu, 05 Feb 2004 16:31:11 +0000 Received: by mainbox.archonet.com (Postfix, from userid 529) id 1771616C47; Thu, 5 Feb 2004 16:31:09 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 8F459168FD; Thu, 5 Feb 2004 16:31:06 +0000 (GMT) From: Richard Huxton To: "Raman Garg" , "pgsql-sql" Subject: Re: TIME ZONE SQL Date: Thu, 5 Feb 2004 16:31:06 +0000 User-Agent: KMail/1.5 References: <200402051100.58825.dev@archonet.com> <00e001c3ebf8$bd6efc50$d4c7a8c0@raman> In-Reply-To: <00e001c3ebf8$bd6efc50$d4c7a8c0@raman> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402051631.06274.dev@archonet.com> X-Bogosity: No, tests=bogofilter, spamicity=0.000000, version=0.15.3 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/55 X-Sequence-Number: 16746 On Thursday 05 February 2004 14:59, Raman Garg wrote: > Hi Richard, > > What I am having is > > CREATE TABLE "customer_events" ( > "event_id" numeric (10) NOT NULL, > "customer_id" numeric (10) NOT NULL, > "event_name" varchar (100) , > "event_datetime" date , > "start_time" time , > "repeat_untill_date" date , > "send_before_time" time, > "time_difference" time > PRIMARY KEY ("event_id")) > > So my "send_before_time" is of datatype "time" only as you have assumed. > only difference was, In your table you are having time_difference field as > "interval" type. > > I am subtracting time field from a time field. i.e. start_time::time - > send_before_time::time > so creating (start_time::time - send_before_time::time) as start_pt is not > making any difference at my side. > (I hope I am getting your point what you have explained) My point is that subtracting one time from another does not give you a time. 3:30pm (time) - 2:00pm (time) = 1h30m (interval) If "send_before_time" is an interval (e.g. '1 hour and 30 minutes') you should probably make it an interval. If it is in fact a time (e.g. '2:00 pm') then it doesn't make sense to subtract it. Even if your solution works, I'd recommend getting your types right - it'll save effort later. -- Richard Huxton Archonet Ltd