Re: Can't figure out how to use now() in default for tsrange column (PG 9.2) - Mailing list pgsql-general

From Alban Hertroys
Subject Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)
Date
Msg-id CAF-3MvPByCKiA2hf+TBbBjnrRJ91wt5asAnVo=qz=KZGAj+Jpw@mail.gmail.com
Whole thread Raw
Responses Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)  (Craig Ringer <ringerc@ringerc.id.au>)
Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-general
>> BTW, that second value looks a whole lot like a poorly thought out
>> substitute for 'infinity' ...
>>                         regards, tom lane
>
> That's certainly an interesting comment and I'm open to suggestions! The
> original db has two columns (from_timestamp, to_timestamp). I don't go for
> NULL in the to_timestamp column. Alternatively, a timestamp very, very far
> in the future can throw off query planners.

Tom is telling you that there is a special "timestamp" 'infinity':

alter table the_table alter column the_column set default
tsrange(now()::timestamp without time zone, 'infinity'::timestamp
without time zone);

--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

pgsql-general by date:

Previous
From: Chris Bartlett
Date:
Subject: Re: Can't figure out how to use now() in default for tsrange column (PG 9.2)
Next
From: Olga Vingurt
Date:
Subject: DB fails to start: "Could not read from file "pg_clog/0003" at offset 212992: No error.