How to specify infinity for intervals ?

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: How to specify infinity for intervals ?
Date: 2006-02-20 18:24:05
Message-ID: 20060220182405.GB7427@merkur.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am storing the maximum age a vaccination is due in a
patient (eg. "don't give this vaccination beyond the age of
10 years" or some such). Some vaccinations are to be given
regardless of age.

Up to now I have used NULL to mean "no maximum age". That
doesn't really feel right and also complicates the SQL
needed for retrieving data.

I *could*, of course, use something like '999 years' as a
special value to indicate "no upper limit" figuring that no
one is going to live that long in the foreseeable future.

However, the technically elegant and satisfying solution
would be to be able to use "infinite" with interval data
types much like "infinity" with timestamps. I have tried
various syntax attempts, calculations and casts but haven't
found any returning an interval of infinite length. The docs
and Google don't help, either.

I am running 7.4.9 on Debian 4.0.

Anyone wants to comment/suggest something ?

Thanks,

Karsten
GNUmed developer
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

Responses

Browse pgsql-general by date

  From Date Subject
Next Message A. Kretschmer 2006-02-20 18:24:12 Re: How to determine number of established connections
Previous Message Michael Fuhr 2006-02-20 18:09:09 Re: How to determine number of established connections