From: | Mike Castle <dalgoda(at)ix(dot)netcom(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to perform calculations on 'time' and 'interval' datatypes |
Date: | 2000-12-04 19:39:40 |
Message-ID: | 20001204133940.A19340@thune.mrc-home.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Nov 28, 2000 at 02:16:58PM +0100, Marcin Bajer wrote:
> I do for example a
> SELECT departure1, departure+600::intervals as departure2,
> departure+1000::intervals as departure3, ...
>
> and then departure1 is of time type, but departure2 and following are of
> interval type
Would timestamp be recommended over time? Also, interval can handle things
in the form 'x hour y min'.
Example, from something I'm working on now:
tv=> \d shows
Table "shows"
Attribute | Type | Modifier
-------------+-----------+----------------------------------------------------
title | text | not null
story | text |
channel | integer | not null
start | timestamp | not null
length | interval | not null
status | char(1) | default 'U'
description | text |
comment | text |
number | integer | not null default
nextval('shows_number_seq'::text)
Indices: shows_number_key,
shows_start_channel,
shows_title_story
Constraint: (strpos('ARUW'::text, (status)::text) > 0)
tv=> select start from shows where number=1;
start
------------------------
2000-11-22 10:00:00-06
(1 row)
tv=> update shows set start=start + interval '5 min' where number=1;
UPDATE 1
tv=> select start from shows where number=1;
start
------------------------
2000-11-22 10:05:00-06
(1 row)
mrc
--
Mike Castle Life is like a clock: You can work constantly
dalgoda(at)ix(dot)netcom(dot)com and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen
From | Date | Subject | |
---|---|---|---|
Next Message | The Hermit Hacker | 2000-12-04 20:08:24 | Re: Re: Why PostgreSQL is not that popular as MySQL? |
Previous Message | Christian Ullrich | 2000-12-04 19:21:13 | Re: Failed regression tests with 7.0.3 on Windows NT 4.0 |