Skip site navigation (1) Skip section navigation (2)

A few things on intervals

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: A few things on intervals
Date: 2006-04-28 11:52:09
Message-ID: 445201E9.7000200@magproductions.nl (view raw or flat)
Thread:
Lists: pgsql-general
I am trying to get infinity in an interval type on PostgreSQL 7.4.7.
I can't seem to get this done, even though there's allegedly an 
isfinite(interval) function. For now we use NULL instead, but what would 
have worked?

Next to that I noticed:

  select age('infinity'::timestamp);
                        age
-------------------------------------------------
  -292270 years -8 mons -11 days -04:00:54.775807
(1 row)


Another problem we have is that we want to extract the value and the 
unit seperately from our intervals, mainly to cast them to something 
that can be used in PHP and HTML forms. We don't need to calculate on 
them in PHP, but we'd like to split the number and the type into a text 
and a drop-down field.
I realize that this isn't possible for intervals like '1 year 3 months', 
but we only use relatively simple intervals like '3 months', '6 weeks' 
and '100 hours'.

Is there some easy way to query such intervals in a way that can be 
reliably split up?

Regards,
-- 
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

// Integrate Your World //

Responses

pgsql-general by date

Next:From: Mike LeahyDate: 2006-04-28 12:35:08
Subject: Is it possible to summarize uniqe values from an indexed column?
Previous:From: A. KretschmerDate: 2006-04-28 10:27:40
Subject: Re: How to define + operator for strings

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group