pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Raman Garg <ramang@smartdatainc.com>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Re: TIME ZONE SQL
Date: Thu, 5 Feb 2004 16:31:06 +0000
Message-ID: <200402051631.06274.dev@archonet.com> (raw)
In-Reply-To: <00e001c3ebf8$bd6efc50$d4c7a8c0@raman>
References: <JEEKIPNAKJNCFLMOBKHGOEDKDCAA.email@juergen-cappel.de>
	<200402051100.58825.dev@archonet.com>
	<00e001c3ebf8$bd6efc50$d4c7a8c0@raman>

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



view thread (7+ messages)  latest in thread

Message-ID: <200402051631.06274.dev@archonet.com>
Permalink:  ../200402051631.06274.dev@archonet.com/
Also on:    postgresql.org/message-id/200402051631.06274.dev@archonet.com

 · 

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: dev@archonet.com, ramang@smartdatainc.com
  Subject: Re: TIME ZONE SQL
  In-Reply-To: <200402051631.06274.dev@archonet.com>

* 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