unique index on variable time - Mailing list pgsql-general

From pgsql-general@list.coretech.ro
Subject unique index on variable time
Date
Msg-id 44426BAF.4070703@list.coretech.ro
Whole thread Raw
Responses Re: unique index on variable time
List pgsql-general
hello,

I am interested to know if I can define an unique index on a timestamp
column to reject values within one hour.

insert into table(timestamp_col) values(LOCALTIMESTAMP);
insert into table(timestamp_col) values(LOCALTIMESTAMP + '5
minutes'::INTERVAL);
I want the second insert to fail with "unique violation".

is it possible to do something like that ? I am not interested in
"date_trunc" because I want it to work and for minute 59.

thanks,
Razvan Radu



pgsql-general by date:

Previous
From: "pgsql-general@list.coretech.ro"
Date:
Subject: inet value validation
Next
From: Michael Fuhr
Date:
Subject: Re: unique index on variable time