Re: tstzrange with ... 'infinity'] + upper_inf() using 9.2.4

From: Ralph Graulich <maillist(at)shauny(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tstzrange with ... 'infinity'] + upper_inf() using 9.2.4
Date: 2013-05-01 23:28:09
Message-ID: A9103D7E-4B8E-41C3-A009-081C0762B74D@shauny.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> No, that's the point of the sentence about the range mechanisms not
> understanding special values of the underlying type. upper_inf tests
> for a range with no upper bound, period. It would need some
> type-specific special knowledge to do what you're hoping for, and it
> has not got that.

Got that, thanks Tom!

So I can simply use

select tstzrange('2013-05-01'::timestamp, 'infinity'::timestamp, '[]') @> 'infinity'::timestamptz as validity;
validity
----------
t
(1 row)

to test for the case where the upper bound is given (= not null) and infinite.

And when one formerly used two timestamptz fields (valid_from, valid_until) to simulate the range type before the range type was implemented and checked for

WHERE valid_until IS NULL

that's where we now use the "upper_inf()" function.

Regards
Ralph

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karthik GP 2013-05-01 23:34:46 MKDIR_P@: Command not found error in regression test
Previous Message Tom Lane 2013-05-01 22:56:38 Re: zLinux Load Testing Experience